P2Hash

Implements a disctionary that stores objects indexed by keys. The keys are string types.

Factory Messages

Operational Messages

do: aBlock

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.

collate: aBlock

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 collated and returned in an array.

at: aKey put: anObject

Answer anObject. Store anObject in the table with aKey. If aKey already exists the previous value is overridden.

remove: aKey

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

has: aKey

Answer true if the given key exists otherwise false

at: aKey ifAbsent: aBlock

Answer the value associated with the given key. If not found evaluate block (with no arguments) and return its result

at: aKey

Answer the value associated with the given key. Throws a Ponder2ArgumentException error if not found.