Implements a dictionary that stores objects indexed by keys. The keys are string types.
Operation | Return | Description |
do: aBlock |
self |
Takes a block and executes the block once for each entry in the hash. The arguments to the block are the name of the entry and the value of the entry. Answers with the receiver. |
collect: aBlock |
P2Array |
Takes a block and executes the block once for each entry in the hash. The arguments to the block are the name of the entry and the value of the entry. The result of each block is collected and returned in an array. |
listNames |
P2Object |
answers an array containing the names of all the domain's entries. |
listObjects |
P2Object |
answers an array of Managed Object names containing all the entries in the domain. |
asArray |
P2Array |
answers an array containing name, values, name, value ... entries from the receiver |
at: aKey put: anObject |
P2Object |
Answer anObject. Store anObject in the table with aKey. If aKey already exists the previous value is overridden. |
remove: aKey |
P2Object |
Answer the value associated with the given key and remove it from the table. Answer Null if it is not found. TODO Should fail if not found |
removeObject: anObject |
boolean |
Removes anObject from the receiver. All copies of anObject will be removed. Answers true if one or more were removed. |
removeAll |
self |
Removes all objects stored in the receiver. Answers self. |
has: aKey |
boolean |
Answer true if the given key exists otherwise false |
hasObject: anObject |
boolean |
Answer true if anObject is in the receiver |
at: aKey ifAbsent: aBlock |
P2Object |
Answer the value associated with the given key. If not found evaluate block (with no arguments) and return its result |
at: aKey |
P2Object |
Answer the value associated with the given key. Throws a Ponder2ArgumentException error if not found. |
size |
int |
Answer the number of elements in the receiver. |