[intro]     [up]

Class Map


This class contains a set of Pairs.

Example
var map = new Map();
map.put("name", "John Smith");
map.put("sex", "male");
map.put("age", 35);
alert(map.getPairs());
alert("Removed Pair: " + map.remove("sex"));


Constructor Arguments
Name Type Default Description
pairs Pair[] Empty Array The pairs array

Properties
afterRemove A callback function called after an pair is removed
afterSet A callback function called after an pair is added or updated
pairs The pairs array

Methods
clear Removes all pairs, returning them
get Returns the value associated with the key
getEntries Synonym to getPairs()
getKeys Returns an Array containing all keys
getPairs Returns an Array containing all pairs
getValues Returns an Array containing all values
put Adds the pair to the collection
putPair Adds the pair to the collection
remove Removes the pair with the given key, returning it
size Returns the number of pairs in this Map
toObject Returns an object containg a property for every pair in this map



Properties
afterRemove
A callback function called after an pair is removed. The Pair and this Map are passed as arguments
afterSet
A callback function called after an pair is added or updated. The Pair and this Map are passed as arguments
pairs
The pairs array





Methods
 
clear
Removes all pairs, returning them
 
get
Returns the value associated with the key
Arguments
Name Type Default Description
key Object   The key
 
getEntries
Synonym to getPairs()
 
getKeys
Returns an Array containing all keys
 
getPairs
Returns an Array containing all pairs
 
getValues
Returns an Array containing all values
 
put
Adds the pair to the collection
Arguments
Name Type Default Description
key Object   The key
value Object   The value
 
putPair
Adds the pair to the collection. This method replaces the old putValue() method
Arguments
Name Type Default Description
pair Pair   The Pair to add
 
remove
Removes the pair with the given key, returning it
Arguments
Name Type Default Description
key Object   The key
 
size
Returns the number of pairs in this Map
 
toObject
Returns an object containg a property for every pair in this map