Map

Members

Functions

byKey
InputRange!K byKey()
Undocumented in source.
byValue
InputRange!V byValue()
Undocumented in source.
clear
void clear()

Removes all of the mappings from this map (optional operation). The map will be empty after this call returns.

computeIfAbsent
V computeIfAbsent(K key, Function!(K, V) mappingFunction)

If the specified key is not already associated with a value (or is mapped to {@code null}), attempts to compute its value using the given mapping function and enters it into this map unless {@code null}.

containsKey
bool containsKey(K key)

Returns <tt>true</tt> if this map contains a mapping for the specified key. More formally, returns <tt>true</tt> if and only if this map contains a mapping for a key <tt>k</tt> such that <tt>(key==null ? k==null : key.equals(k))</tt>. (There can be at most one such mapping.)

containsValue
bool containsValue(V value)

Returns <tt>true</tt> if this map maps one or more keys to the specified value. More formally, returns <tt>true</tt> if and only if this map contains at least one mapping to a value <tt>v</tt> such that <tt>(value==null ? v==null : value.equals(v))</tt>. This operation will probably require time linear in the map size for most implementations of the <tt>Map</tt> interface.

get
V get(K key)

Returns the value to which the specified key is mapped, or {@code null} if this map contains no mapping for the key.

isEmpty
bool isEmpty()

Returns <tt>true</tt> if this map contains no key-value mappings.

opApply
int opApply(int delegate(ref K, ref V) dg)
int opApply(int delegate(MapEntry!(K, V) entry) dg)

Performs the given action for each entry in this map until all entries have been processed or the action throws an exception. Unless otherwise specified by the implementing class, actions are performed in the order of entry set iteration (if an iteration order is specified.) Exceptions thrown by the action are relayed to the caller.

opIndex
V opIndex(K key)
Undocumented in source.
put
V put(K key, V value)

Associates the specified value with the specified key in this map (optional operation). If the map previously contained a mapping for the key, the old value is replaced by the specified value. (A map <tt>m</tt> is said to contain a mapping for a key <tt>k</tt> if and only if {@link #containsKey(Object) m.containsKey(k)} would return <tt>true</tt>.)

putAll
void putAll(Map!(K, V) m)

Copies all of the mappings from the specified map to this map (optional operation). The effect of this call is equivalent to that of calling {@link #put(Object,Object) put(k, v)} on this map once for each mapping from key <tt>k</tt> to value <tt>v</tt> in the specified map. The behavior of this operation is undefined if the specified map is modified while the operation is in progress.

putIfAbsent
V putIfAbsent(K key, V value)

If the specified key is not already associated with a value (or is mapped to {@code null}) associates it with the given value and returns {@code null}, else returns the current value.

remove
V remove(K key)

Removes the mapping for a key from this map if it is present (optional operation). More formally, if this map contains a mapping from key <tt>k</tt> to value <tt>v</tt> such that <code>(key==null ? k==null : key.equals(k))</code>, that mapping is removed. (The map can contain at most one such mapping.)

remove
bool remove(K key, V value)

Removes the entry for the specified key only if it is currently mapped to the specified value.

replace
bool replace(K key, V oldValue, V newValue)

Replaces the entry for the specified key only if currently mapped to the specified value.

replace
V replace(K key, V value)

Replaces the entry for the specified key only if it is currently mapped to some value.

size
int size()

Returns the number of key-value mappings in this map. If the map contains more than <tt>Integer.MAX_VALUE</tt> elements, returns <tt>Integer.MAX_VALUE</tt>.

toHash
size_t toHash()

Returns the hash code value for this map. The hash code of a map is defined to be the sum of the hash codes of each entry in the map's <tt>entrySet()</tt> view. This ensures that <tt>m1.equals(m2)</tt> implies that <tt>m1.toHash()==m2.toHash()</tt> for any two maps <tt>m1</tt> and <tt>m2</tt>, as required by the general contract of {@link Object#toHash}.

toString
string toString()
Undocumented in source.
values
V[] values()

Returns a {@link Collection} view of the values contained in this map. The collection is backed by the map, so changes to the map are reflected in the collection, and vice-versa. If the map is modified while an iteration over the collection is in progress (except through the iterator's own <tt>remove</tt> operation), the results of the iteration are undefined. The collection supports element removal, which removes the corresponding mapping from the map, via the <tt>Iterator.remove</tt>, <tt>Collection.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt> and <tt>clear</tt> operations. It does not support the <tt>add</tt> or <tt>addAll</tt> operations.

Inherited Members

From IObject

opEquals
bool opEquals(IObject o)
Undocumented in source.
toString
string toString()
Undocumented in source.
toHash
size_t toHash()
Undocumented in source.

From Cloneable

clone
Object clone()
Undocumented in source.

Meta