Class IntHashMap<V>
- java.lang.Object
-
- org.apache.ignite.internal.util.collection.IntHashMap<V>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.ignite.internal.util.collection.IntMap
IntMap.EntryConsumer<V,E extends Throwable>
-
-
Field Summary
Fields Modifier and Type Field Description static intINITIAL_CAPACITYInitial capacity.static intMAXIMUM_CAPACITYMaximum capacity.
-
Constructor Summary
Constructors Constructor Description IntHashMap()Default constructor.IntHashMap(int cap)Create map with preallocated array.IntHashMap(IntMap<? extends V> other)Copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Removes all of the mappings from this map.booleancontainsKey(int key)Returns true if the map contains the key, otherwise false.booleancontainsValue(V val)Returns true if the map contains one or more values, otherwise false.protected intdistance(int curIdx, int key)Returns size of shift from ideal position computing via index(key).<E extends Throwable>
voidforEach(IntMap.EntryConsumer<V,E> act)This method work under a read lock, be careful with long operations inside.Vget(int key)Returns value associated with the key. if the map doesn't contain the key, returns null.protected intindex(int key)Position in entites array.booleanisEmpty()Returns true if this map contains no key-value mappings.int[]keys()Returns array of keys.Vput(int key, V val)Save the pair into the map.VputIfAbsent(int key, V val)Does put into the map if a pair isn't present, otherwise returns stored value.Vremove(int key)intsize()Returns count of elements.StringtoString()Collection<V>values()Returns a collection of values.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.ignite.internal.util.collection.IntMap
computeIfAbsent
-
-
-
-
Field Detail
-
INITIAL_CAPACITY
public static final int INITIAL_CAPACITY
Initial capacity.- See Also:
- Constant Field Values
-
MAXIMUM_CAPACITY
public static final int MAXIMUM_CAPACITY
Maximum capacity.- See Also:
- Constant Field Values
-
-
Method Detail
-
get
public V get(int key)
Returns value associated with the key. if the map doesn't contain the key, returns null.
-
put
public V put(int key, V val)
Save the pair into the map. If a pair is present, returns old value and store new.
-
remove
public V remove(int key)
-
putIfAbsent
public V putIfAbsent(int key, V val)
Does put into the map if a pair isn't present, otherwise returns stored value.- Specified by:
putIfAbsentin interfaceIntMap<V>- Parameters:
key- key with which the specified value is to be associated..val- value to be associated with the specified key..
-
forEach
public <E extends Throwable> void forEach(IntMap.EntryConsumer<V,E> act) throws E extends Throwable
This method work under a read lock, be careful with long operations inside.
-
isEmpty
public boolean isEmpty()
Returns true if this map contains no key-value mappings.
-
values
public Collection<V> values()
Returns a collection of values.
-
containsKey
public boolean containsKey(int key)
Returns true if the map contains the key, otherwise false.- Specified by:
containsKeyin interfaceIntMap<V>- Parameters:
key- tests key value.
-
containsValue
public boolean containsValue(V val)
Returns true if the map contains one or more values, otherwise false.- Specified by:
containsValuein interfaceIntMap<V>- Parameters:
val- value to be associated with the specified key.
-
clear
public void clear()
Removes all of the mappings from this map.
-
distance
protected int distance(int curIdx, int key)Returns size of shift from ideal position computing via index(key).- Parameters:
curIdx- Current index.key- Target key.
-
index
protected int index(int key)
Position in entites array.- Parameters:
key- Targert key.
-
-