|
|
6.90 LookupTable
- Defined in namespace Smalltalk
- Category: Collections-Keyed
- I am similar to Dictionary, except that my representation is
different (more efficient, but not as friendly to the virtual
machine). I use the object equality comparision message =
to determine equivalence of indices.
6.90.1 LookupTable class: instance creation
- new
- Create a new LookupTable with a default size
6.90.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
6.90.3 LookupTable: copying
- deepCopy
- Returns a deep copy of the receiver (the instance variables are copies of the receiver's instance variables)
6.90.4 LookupTable: enumerating
- associationsDo: aBlock
- Pass each association in the LookupTable to aBlock
- keysAndValuesDo: aBlock
- Pass each key/value pair in the LookupTable as two distinct parameters to aBlock
6.90.5 LookupTable: rehashing
- rehash
- Rehash the receiver
6.90.6 LookupTable: removing
- removeKey: key ifAbsent: aBlock
- Remove the passed key from the LookupTable, answer the result of evaluating aBlock if it is not found
6.90.7 LookupTable: storing
- storeOn: aStream
- Print Smalltalk code compiling to the receiver on aStream
|