Category: Collections-Keyed
Superclass: Dictionary
I am a more efficient variant of Dictionary that cannot be used as a pool dictionary of variables, as I don't use Associations to store key-value pairs. I also cannot have nil as a key; if you need to be able to store nil as a key, use Dictionary instead. I use the object equality comparison message #= to determine equivalence of indices.

Method category index

instance creation (class)
accessing (instance)
enumerating (instance)
hashing (instance)
rehashing (instance)
removing (instance)
storing (instance)

instance creation (class)

new
Create a new LookupTable with a default size

top


accessing (instance)

add: anAssociation
Add the anAssociation key to the receiver

associationAt: key ifAbsent: aBlock

Answer the key/value Association for the given key. Evaluate aBlock (answering the result) if the key is not found

at: key ifAbsent: aBlock

Answer the value associated to the given key, or the result of evaluating aBlock if the key is not found

at: aKey ifPresent: aBlock

If aKey is absent, answer nil. Else, evaluate aBlock passing the associated value and answer the result of the invocation

at: key put: value

Store value as associated to the given key

top


enumerating (instance)

associationsDo: aBlock
Pass each association in the LookupTable to aBlock.

do: aBlock

Pass each value in the LookupTable to aBlock.

keysAndValuesDo: aBlock

Pass each key/value pair in the LookupTable as two distinct parameters to aBlock.

keysDo: aBlock

Pass each key in the LookupTable to aBlock.

top


hashing (instance)

hash
Answer the hash value for the receiver

top


rehashing (instance)

rehash
Rehash the receiver

top


removing (instance)

remove: anAssociation
Remove anAssociation's key from the dictionary

remove: anAssociation ifAbsent: aBlock

Remove anAssociation's key from the dictionary

removeKey: key ifAbsent: aBlock

Remove the passed key from the LookupTable, answer the result of evaluating aBlock if it is not found

top


storing (instance)

storeOn: aStream
Print Smalltalk code compiling to the receiver on aStream

top