Libraries
\ HashMap
Reference for Wiring version 1.0 Build 0100+ If you have a previous version, use the reference included with your software. If see any errors or have any comments, let us know.
Name |
HashMap |
Examples |
#include <HashMap.h>
CreateHashMap(hashMap, char*, int, 3);
void setup()
{
Serial.begin(9600);
hashMap["newKey"] = 12;
hashMap["otherKey"] = 13;
Serial.print("Will the hashMap overflow now [after 2 assigns] ?: ");
Serial.println(hashMap.willOverflow());
hashMap["lastKey"] = 14;
Serial.print("Will the hashMap overflow now [after 3 assigns] ?: ");
Serial.println(hashMap.willOverflow());
hashMap["test"] = 15;
Serial.print("The old value of newKey: ");
Serial.println(hashMap["newKey"]);
hashMap["newKey"]++;
Serial.print("The new value of newKey (after hashMap['newKey']++): ");
Serial.println(hashMap["newKey"]);
hashMap.remove("otherKey");
hashMap["test"] = 15;
printHashMap();
}
void loop() {
}
void printHashMap()
{
for (int i=0; i<hashMap.size(); i++)
{
Serial.print("Key: ");
Serial.print(hashMap.keyAt(i));
Serial.print(" Value: ");
Serial.println(hashMap.valueAt(i));
}
}
|
Description |
Implementation of a HashMap data structure for the Wiring platform. |
Syntax |
HashMap(compare)
|
Methods |
|
Parameters |
compare |
Optional function for comparing a key against another (for complex types) |
|
|
|
Returns |
None |
Usage |
Application |
Updated on July 07, 2011 11:10:21pm PDT