|Method from org.apache.mahout.math.map.OpenHashMap Detail:|
public void clear()
Removes all (key,value) associations from the receiver. Implicitly calls trimToSize().
public Object clone()
Returns a deep copy of the receiver.
public boolean containsKey(Object key)
Returns true if the receiver contains the specified key.
public boolean containsValue(Object value)
Returns true if the receiver contains the specified value.
public void ensureCapacity(int minCapacity)
Ensures that the receiver can hold at least the specified number of associations without needing to allocate new
internal memory. If necessary, allocates new internal memory and increases the capacity of the receiver.
method never need be called; it is for performance tuning only. Calling this method before put()ing a
large number of associations boosts performance, because the receiver will grow only once instead of potentially
many times and hash collisions get less probable.
public Set<K, V> entrySet()
Allocate a set to contain Map.Entry objects for the pairs and return it.
public boolean equals(Object obj)
public boolean forEachKey(ObjectProcedure<K> procedure)
Applies a procedure to each key of the receiver, if any. Note: Iterates over the keys in no particular order.
Subclasses can define a particular order, for example, "sorted by key". All methods which can be expressed
in terms of this method (most methods can) must guarantee to use the same order defined by this
method, even if it is no particular order. This is necessary so that, for example, methods keys and
values will yield association pairs, not two uncorrelated lists.
public boolean forEachPair(ObjectObjectProcedure<K, V> procedure)
Applies a procedure to each (key,value) pair of the receiver, if any. Iteration order is guaranteed to be
identical to the order used by method #forEachKey(ObjectProcedure) .
public V get(Object key)
Returns the value associated with the specified key. It is often a good idea to first check with #containsKey(Object) whether the given key has a value associated or not, i.e. whether there exists an association
for the given key or not.
void getInternalFactors(int capacity,
protected int indexOfInsertion(K key)
protected int indexOfKey(K key)
protected int indexOfValue(V value)
public Set<K> keySet()
Allocate a set to contain keys and return it.
This violates the 'backing' provisions of the map interface.
public void keys(List<K> list)
Fills all keys contained in the receiver into the specified list. Fills the list, starting at index 0. After this
call returns the specified list has a new size that equals this.size().
This method can be used
to iterate over the keys of the receiver.
public V put(K key,
Associates the given key with the given value. Replaces any old (key,someOtherValue) association, if
public void putAll(Map<? extends K, ? extends V> m)
protected void rehash(int newCapacity)
Rehashes the contents of the receiver into a new table with a smaller or larger capacity. This method is called
automatically when the number of keys in the receiver exceeds the high water mark or falls below the low water
public V remove(Object key)
Removes the given key with its associated element from the receiver, if present.
protected void setUp(int initialCapacity,
Initializes the receiver.
public String toString()
public void trimToSize()
Trims the capacity of the receiver to be the receiver's current size. Releases any superfluous internal memory. An
application can use this operation to minimize the storage of the receiver.
public Collection<V> values()
Allocate a list to contain the values and return it.
This violates the 'backing' provision of the Map interface.