public class OpenLongIntHashMap extends OpenAbstractCollection
HashMap,
Serialized FormFREE, freeEntries, FULL, REMOVED, state, tabledefaultCapacity, defaultMaxLoadFactor, defaultMinLoadFactor, distinct, highWaterMark, lowWaterMark, maxLoadFactor, minLoadFactor| Constructor and Description |
|---|
OpenLongIntHashMap()
Constructs an empty map with default capacity and default load factors.
|
OpenLongIntHashMap(int initialCapacity)
Constructs an empty map with the specified initial capacity and default
load factors.
|
OpenLongIntHashMap(int initialCapacity,
double minLoadFactor,
double maxLoadFactor)
Constructs an empty map with the specified initial capacity and the
specified minimum and maximum load factor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Removes all (key,value) associations from the receiver.
|
Object |
clone()
Returns a deep copy of the receiver.
|
boolean |
containsValue(int value)
Returns true if the receiver contains the specified value.
|
boolean |
forEachPair(LongIntProcedure procedure)
Applies a procedure to each (key,value) pair of the receiver, if any.
|
int |
get(long key)
Returns the value associated with the specified key.
|
protected int |
indexOfValue(int value) |
long |
keyOf(int value)
Returns the first key the given value is associated with.
|
void |
keys(LongArrayList list)
Fills all keys contained in the receiver into the specified list.
|
void |
pairsMatching(LongIntProcedure condition,
LongArrayList keyList,
IntArrayList valueList)
Fills all pairs satisfying a given condition into the specified lists.
|
boolean |
put(long key,
int value)
Associates the given key with the given value.
|
protected void |
rehash(int newCapacity)
Rehashes the contents of the receiver into a new table with a smaller or
larger capacity.
|
boolean |
removeKey(long key)
Removes the given key with its associated element from the receiver, if
present.
|
protected void |
setUp(int initialCapacity,
double minLoadFactor,
double maxLoadFactor)
Initializes the receiver.
|
void |
values(IntArrayList list)
Fills all values contained in the receiver into the specified list.
|
containsKey, ensureCapacity, forEachKey, indexOfInsertion, indexOfKey, trimToSizechooseGrowCapacity, chooseHighWaterMark, chooseLowWaterMark, chooseMeanCapacity, chooseShrinkCapacity, isEmpty, nextPrime, sizepublic OpenLongIntHashMap()
public OpenLongIntHashMap(int initialCapacity)
initialCapacity - the initial capacitypublic OpenLongIntHashMap(int initialCapacity,
double minLoadFactor,
double maxLoadFactor)
initialCapacity - the initial capacityminLoadFactor - the min load factormaxLoadFactor - the max load factorpublic final void clear()
clear in class AbstractMappublic final Object clone()
clone in class PersistentObjectpublic final boolean containsValue(int value)
value - the valuepublic final boolean forEachPair(LongIntProcedure procedure)
OpenAbstractCollection.forEachKey(LongProcedure).procedure - the procedure to be applied. Stops iteration if the procedure
returns false, otherwise continues.public final int get(long key)
OpenAbstractCollection.containsKey(long) whether the given key
has a value associated or not, i.e. whether there exists an association
for the given key or not.key - the key to be searched for.protected final int indexOfValue(int value)
value - the value to be searched in the receiver.public final long keyOf(int value)
containsValue(int) whether
there exists an association from a key to this value. Search order is
guaranteed to be identical to the order used by method
OpenAbstractCollection.forEachKey(LongProcedure).value - the value to search for.public final void keys(LongArrayList list)
OpenAbstractCollection.forEachKey(LongProcedure).
This method can be used to iterate over the keys of the receiver.
list - the list to be filled, can have any size.public final void pairsMatching(LongIntProcedure condition, LongArrayList keyList, IntArrayList valueList)
OpenAbstractCollection.forEachKey(LongProcedure).
Example:
LongObjectProcedure condition = new LongObjectProcedure() { // match even keys only
public boolean apply(long key, Object value) { return key%2==0; }
}
keys = (8,7,6), values = (1,2,2) --> keyList = (6,8), valueList = (2,1)
condition - the condition to be matched. Takes the current key as first
and the current value as second argument.keyList - the list to be filled with keys, can have any size.valueList - the list to be filled with values, can have any size.public final boolean put(long key,
int value)
key - the key the value shall be associated with.value - the value to be associated.protected final void rehash(int newCapacity)
newCapacity - the new capacitypublic final boolean removeKey(long key)
key - the key to be removed from the receiver.protected final void setUp(int initialCapacity,
double minLoadFactor,
double maxLoadFactor)
setUp in class AbstractMapinitialCapacity - the initial capacity of the receiver.minLoadFactor - the minLoadFactor of the receiver.maxLoadFactor - the maxLoadFactor of the receiver.public final void values(IntArrayList list)
OpenAbstractCollection.forEachKey(LongProcedure).
This method can be used to iterate over the values of the receiver.
list - the list to be filled, can have any size.Copyright © 2019 TomTom International B.V.. All rights reserved.