TwoWayIdentityDictionary: table of contents
Filter:
Classes | Collections > Unordered

TwoWayIdentityDictionary : Collection : Object

associative collection mapping keys to values and back
Subclasses: ObjectTable

Description

Similar to IdentityDictionary, but allows to go efficiently from element to key and back. The contents of a TwoWayIdentityDictionary are unordered. You must not depend on the order of items.

Class Methods

Inherited class methods

Undocumented class methods

TwoWayIdentityDictionary.new

Instance Methods

.getID(obj)

Find the key for a given object. If object is not element of the dictionary, it returns nil.

Inherited instance methods

Undocumented instance methods

.add(anAssociation)

.at(id)

.do(function)

.printItemsOn(stream, itemsPerLine: 5)

.put(key, obj)

.remove(obj)

.removeAt(key)

.storeItemsOn(stream, itemsPerLine: 5)

Examples

a = TwoWayIdentityDictionary.new;
a.put(\test, 999);
a.put(["some", "strings"], 1200);
a.at(\test);
a.getID(999);
a.getID(1200);
a.getID(888); // nil