Next: , Previous: Dictionary class-instance creation, Up: Dictionary


1.62.2 Dictionary: accessing

add: newObject
Add the newObject association to the receiver


addAll: aCollection
Adds all the elements of 'aCollection' to the receiver, answer aCollection


associationAt: key
Answer the key/value Association for the given key. Fail if the key is not found


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


associations
Returns the content of a Dictionary as a Set of Associations.


at: key
Answer the value associated to the given key. Fail 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 ifAbsentPut: aBlock
Answer the value associated to the given key. If the key is not found, evaluate aBlock and associate the result to aKey before returning.


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


atAll: keyCollection
Answer a Dictionary that only includes the given keys. Fail if any of them is not found


keyAtValue: value
Answer the key associated to the given value, or nil if the value is not found


keyAtValue: value ifAbsent: exceptionBlock
Answer the key associated to the given value. Evaluate exceptionBlock (answering the result) if the value is not found. IMPORTANT: == is used to compare values


keys
Answer a kind of Set containing the keys of the receiver


values
Answer an Array containing the values of the receiver