An identity map implemented as a hash map stored in an
Array
of singly linked lists of Entry
s. The hash
code of a key is defined by identityHash()
. Note that an
IdentityMap
is not a Map
, since it does not obey the
semantics of a Map
. In particular, it may contain
multiple keys which are equal, as determined by the ==
operator.
no subtypes hierarchy
Initializer |
IdentityMap(Hashtable hashtable = ..., {<Key->Item>*} entries = ...) Parameters:
|
Attributes | |
hash | Source Codeshared actual Integer hash The hash value of the value, which allows the value to be an element of a hash-based set or key of a hash-based map. Implementations must respect the constraint that:
Therefore, a class which refines In general, Note that when executing on a Java Virtual Machine, the
64-bit |
size | Source Codeshared actual Integer size The number of elements returned by the Refines Iterable.size |
Inherited Attributes |
Attributes inherited from: Object |
Attributes inherited from: Collection<Element> |
Attributes inherited from: Correspondence<Key,Item> |
Attributes inherited from: Iterable<Element,Absent> |
Methods | |
clear | Source Codeshared void clear() Removes every key/value mapping |
clone | Source Codeshared actual IdentityMap<Key,Item> clone() A shallow copy of this collection, that is, a collection with identical elements which does not change if this collection changes. If this collection is immutable, it is acceptable to return a reference to this collection. If this collection is mutable, a newly instantiated collection must be returned. Refines Collection.clone |
contains | Source Codeshared actual Boolean contains(Object element) Returns For any instance element in c For most
However, it is possible to form a useful |
count | Source Codeshared actual Integer count(Boolean selecting(Key->Item element)) Produces the number of elements in this stream that
satisfy the given predicate function ( Refines Iterable.count |
defines | Source Codeshared actual Boolean defines(Key key) Determines if there is a value defined for the given key. Refines Correspondence.defines |
each | Source Codeshared actual void each(void step(Key->Item element)) Call the given function ( For example: words.each((word) { print(word.lowercased); print(word.uppercased); }); Has the same effect as the following for (word in words) { print(word.lowercased); print(word.uppercased); } For certain streams this method is highly efficient,
surpassing the performance of Refines Iterable.each |
equals | Source Codeshared actual Boolean equals(Object that) Determine if two values are equal. For any two non-null objects x == y Implementations should respect the constraints that:
Furthermore it is recommended that implementations
ensure that if A class which explicitly refines Note that an implementation of |
get | Source Codeshared actual Item? get(Key key) Returns the value defined for the given key, or For any instance c[key] Refines Correspondence.get |
iterator | Source Codeshared actual Iterator<Key->Item> iterator() An iterator for the elements belonging to this stream. If this is a nonempty stream with type Refines Iterable.iterator |
put | Source Codeshared Item? put(Key key, Item item) |
putAll | Source Codeshared void putAll({<Key->Item>*} entries) Adds a collection of key/value mappings to this map, may be used to change existing mappings |
remove | Source Codeshared Item? remove(Key key) Removes a key/value mapping if it exists |
removeAll | Source Codeshared void removeAll({Key*} keys) Remove the entries associated with the given keys, if any, from this map |
removeEntry | Source Codeshared Boolean removeEntry(Key key, Item&Object item) |
replaceEntry | Source Codeshared Boolean replaceEntry(Key key, Item&Object item, Item newItem) |
Inherited Methods |
Methods inherited from: Object |
Methods inherited from: Category<Element> |
Methods inherited from: Collection<Element> |
Methods inherited from: Correspondence<Key,Item> |
Methods inherited from: Iterable<Element,Absent> any() , by() , chain() , collect() , contains() , count() , defaultNullElements() , each() , every() , filter() , find() , findLast() , flatMap() , fold() , follow() , frequencies() , getFromFirst() , group() , indexes() , interpose() , iterator() , locate() , locateLast() , locations() , longerThan() , map() , max() , narrow() , partition() , product() , reduce() , repeat() , scan() , select() , sequence() , shorterThan() , skip() , skipWhile() , sort() , spread() , summarize() , tabulate() , take() , takeWhile() |