Back: LookupKey-testing Up: Base classes Forward: LookupTable class-instance creation   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document

1.104 LookupTable

Defined in namespace Smalltalk
Superclass: Dictionary
Category: Collections-Keyed
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.

1.104.1 LookupTable class: instance creation  (class)
1.104.2 LookupTable: accessing  (instance)
1.104.3 LookupTable: enumerating  (instance)
1.104.4 LookupTable: hashing  (instance)
1.104.5 LookupTable: rehashing  (instance)
1.104.6 LookupTable: removing  (instance)
1.104.7 LookupTable: storing  (instance)


1.104.1 LookupTable class: instance creation

new
Create a new LookupTable with a default size


1.104.2 LookupTable: accessing

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


1.104.3 LookupTable: enumerating

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.


1.104.4 LookupTable: hashing

hash
Answer the hash value for the receiver


1.104.5 LookupTable: rehashing

rehash
Rehash the receiver


1.104.6 LookupTable: removing

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


1.104.7 LookupTable: storing

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



Back: LookupTable-removing Up: LookupTable Forward: Magnitude   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document


This document was generated on April, 16 2013 using texi2html