V - the keyType of elements maintained by this Collectionpublic class Long2ObjectOpenHashMap<V> extends AbstractLong2ObjectMap<V> implements ITrimmable
AbstractLong2ObjectMap.BasicEntry<V>java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>Long2ObjectMap.BuilderCache<V>, Long2ObjectMap.Entry<V>, Long2ObjectMap.FastEntrySet<V>, Long2ObjectMap.MapBuilder| Constructor and Description |
|---|
Long2ObjectOpenHashMap()
Default Constructor
|
Long2ObjectOpenHashMap(int minCapacity)
Constructor that defines the minimum capacity
|
Long2ObjectOpenHashMap(int minCapacity,
float loadFactor)
Constructor that defines the minimum capacity and load factor
|
Long2ObjectOpenHashMap(long[] keys,
V[] values)
Helper constructor that allow to create a map from unboxed values
|
Long2ObjectOpenHashMap(java.lang.Long[] keys,
V[] values)
Helper constructor that allow to create a map from boxed values (it will unbox them)
|
Long2ObjectOpenHashMap(long[] keys,
V[] values,
float loadFactor)
Helper constructor that allow to create a map from unboxed values
|
Long2ObjectOpenHashMap(java.lang.Long[] keys,
V[] values,
float loadFactor)
Helper constructor that allow to create a map from boxed values (it will unbox them)
|
Long2ObjectOpenHashMap(Long2ObjectMap<V> map)
A Type Specific Helper function that allows to create a new Map with exactly the same values as the provided map.
|
Long2ObjectOpenHashMap(Long2ObjectMap<V> map,
float loadFactor)
A Type Specific Helper function that allows to create a new Map with exactly the same values as the provided map.
|
Long2ObjectOpenHashMap(java.util.Map<? extends java.lang.Long,? extends V> map)
A Helper constructor that allows to create a Map with exactly the same values as the provided map.
|
Long2ObjectOpenHashMap(java.util.Map<? extends java.lang.Long,? extends V> map,
float loadFactor)
A Helper constructor that allows to create a Map with exactly the same values as the provided map.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
void |
clearAndTrim(int size)
Trims the collection down to the requested size and clears all elements while doing so
|
V |
compute(long key,
LongObjectUnaryOperator<V> mappingFunction)
A Type Specific compute method to reduce boxing/unboxing
|
V |
computeIfAbsent(long key,
LongFunction<V> mappingFunction)
A Type Specific compute method to reduce boxing/unboxing
|
V |
computeIfPresent(long key,
LongObjectUnaryOperator<V> mappingFunction)
A Type Specific compute method to reduce boxing/unboxing
|
boolean |
containsKey(long key)
Type Specific method to reduce boxing/unboxing of values
|
boolean |
containsKey(java.lang.Object key)
Deprecated.
|
boolean |
containsValue(java.lang.Object value) |
Long2ObjectOpenHashMap<V> |
copy()
A Function that does a shallow clone of the Map itself.
|
void |
forEach(LongObjectConsumer<V> action)
Type Specific forEach method to reduce boxing/unboxing
|
V |
get(long key)
A Type Specific get method to reduce boxing/unboxing
|
V |
get(java.lang.Object key) |
V |
getOrDefault(long key,
V defaultValue)
A Type Specific getOrDefault method to reduce boxing/unboxing
|
LongSet |
keySet() |
ObjectSet<Long2ObjectMap.Entry<V>> |
long2ObjectEntrySet()
Type Sensitive EntrySet to reduce boxing/unboxing and optionally Temp Object Allocation.
|
V |
merge(long key,
V value,
ObjectObjectUnaryOperator<V,V> mappingFunction)
A Type Specific merge method to reduce boxing/unboxing
|
void |
mergeAll(Long2ObjectMap<V> m,
ObjectObjectUnaryOperator<V,V> mappingFunction)
A Bulk method for merging Maps.
|
V |
put(long key,
V value)
Type Specific method to reduce boxing/unboxing of values
|
V |
putIfAbsent(long key,
V value)
Type Specific method to reduce boxing/unboxing of values
|
V |
remove(long key)
Type Specific remove function to reduce boxing/unboxing
|
boolean |
remove(long key,
V value)
Type Specific remove function to reduce boxing/unboxing
|
V |
remove(java.lang.Object key) |
boolean |
remove(java.lang.Object key,
java.lang.Object value) |
V |
removeOrDefault(long key,
V defaultValue)
Type-Specific Remove function with a default return value if wanted.
|
V |
replace(long key,
V value)
A Type Specific replace method to reduce boxing/unboxing replace an existing value
|
boolean |
replace(long key,
V oldValue,
V newValue)
A Type Specific replace method to replace an existing value
|
int |
size() |
V |
supplyIfAbsent(long key,
ObjectSupplier<V> valueProvider)
A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
boolean |
trim(int size)
Trims the original collection down to the size of the current elements or the requested size depending which is bigger
|
ObjectCollection<V> |
values() |
entrySet, equals, getDefaultReturnValue, getOrDefault, hashCode, put, putAll, putAll, putAll, putAll, putAllIfAbsent, replaceObjects, replaceObjects, setDefaultReturnValueclearAndTrim, trimapply, builder, compute, computeIfAbsent, computeIfPresent, forEach, merge, put, put, putAll, putAll, putIfAbsent, replace, replace, replaceAll, synchronize, synchronize, unmodifiablepublic Long2ObjectOpenHashMap()
public Long2ObjectOpenHashMap(int minCapacity)
minCapacity - the minimum capacity the HashMap is allowed to be.java.lang.IllegalStateException - if the minimum capacity is negativepublic Long2ObjectOpenHashMap(int minCapacity,
float loadFactor)
minCapacity - the minimum capacity the HashMap is allowed to be.loadFactor - the percentage of how full the backing array can be before they resizejava.lang.IllegalStateException - if the minimum capacity is negativejava.lang.IllegalStateException - if the loadfactor is either below/equal to 0 or above/equal to 1public Long2ObjectOpenHashMap(java.lang.Long[] keys,
V[] values)
keys - the keys that should be put into the mapvalues - the values that should be put into the map.java.lang.IllegalStateException - if the keys and values do not match in lenghtpublic Long2ObjectOpenHashMap(java.lang.Long[] keys,
V[] values,
float loadFactor)
keys - the keys that should be put into the mapvalues - the values that should be put into the map.loadFactor - the percentage of how full the backing array can be before they resizejava.lang.IllegalStateException - if the keys and values do not match in lenghtjava.lang.IllegalStateException - if the loadfactor is either below/equal to 0 or above/equal to 1public Long2ObjectOpenHashMap(long[] keys,
V[] values)
keys - the keys that should be put into the mapvalues - the values that should be put into the map.java.lang.IllegalStateException - if the keys and values do not match in lenghtpublic Long2ObjectOpenHashMap(long[] keys,
V[] values,
float loadFactor)
keys - the keys that should be put into the mapvalues - the values that should be put into the map.loadFactor - the percentage of how full the backing array can be before they resizejava.lang.IllegalStateException - if the keys and values do not match in lenghtjava.lang.IllegalStateException - if the loadfactor is either below/equal to 0 or above/equal to 1public Long2ObjectOpenHashMap(java.util.Map<? extends java.lang.Long,? extends V> map)
map - the values that should be present in the mappublic Long2ObjectOpenHashMap(java.util.Map<? extends java.lang.Long,? extends V> map, float loadFactor)
map - the values that should be present in the maploadFactor - the percentage of how full the backing array can be before they resizejava.lang.IllegalStateException - if the loadfactor is either below/equal to 0 or above/equal to 1public Long2ObjectOpenHashMap(Long2ObjectMap<V> map)
map - the values that should be present in the mappublic Long2ObjectOpenHashMap(Long2ObjectMap<V> map, float loadFactor)
map - the values that should be present in the maploadFactor - the percentage of how full the backing array can be before they resizejava.lang.IllegalStateException - if the loadfactor is either below/equal to 0 or above/equal to 1public V put(long key, V value)
Long2ObjectMapput in interface Long2ObjectMap<V>key - the key that should be inserted,value - the value that should be insertedMap.put(Object, Object)public V putIfAbsent(long key, V value)
Long2ObjectMapputIfAbsent in interface Long2ObjectMap<V>key - the key that should be inserted,value - the value that should be insertedMap.putIfAbsent(Object, Object)public boolean containsKey(long key)
Long2ObjectMapcontainsKey in interface Long2ObjectMap<V>containsKey in class AbstractLong2ObjectMap<V>key - element that is searched for@Deprecated public boolean containsKey(java.lang.Object key)
containsKey in interface java.util.Map<java.lang.Long,V>containsKey in interface Long2ObjectMap<V>containsKey in class java.util.AbstractMap<java.lang.Long,V>key - that is searched for.Map.containsKey(Object)public boolean containsValue(java.lang.Object value)
containsValue in interface java.util.Map<java.lang.Long,V>containsValue in class AbstractLong2ObjectMap<V>public V remove(long key)
Long2ObjectMapremove in interface Long2ObjectMap<V>key - the element that should be removedpublic V removeOrDefault(long key, V defaultValue)
Long2ObjectMapremoveOrDefault in interface Long2ObjectMap<V>key - the element that should be removeddefaultValue - the value that should be returned if the entry doesn't existMap.remove(Object, Object)public V remove(java.lang.Object key)
remove in interface java.util.Map<java.lang.Long,V>remove in interface Long2ObjectMap<V>remove in class AbstractLong2ObjectMap<V>key - the element that should be removedMap.remove(Object)public boolean remove(long key,
V value)
Long2ObjectMapremove in interface Long2ObjectMap<V>key - the element that should be removedvalue - the expected value that should be foundMap.remove(Object, Object)public boolean remove(java.lang.Object key,
java.lang.Object value)
remove in interface java.util.Map<java.lang.Long,V>remove in interface Long2ObjectMap<V>key - the element that should be removedvalue - the expected value that should be foundMap.remove(Object, Object)public V get(long key)
Long2ObjectMapget in interface Long2ObjectMap<V>key - the key that is searched forpublic V get(java.lang.Object key)
get in interface java.util.Map<java.lang.Long,V>get in interface Long2ObjectMap<V>get in class AbstractLong2ObjectMap<V>public V getOrDefault(long key, V defaultValue)
Long2ObjectMapgetOrDefault in interface Long2ObjectMap<V>getOrDefault in class AbstractLong2ObjectMap<V>key - the key that is searched fordefaultValue - the value that should be returned if the key is not presentpublic Long2ObjectOpenHashMap<V> copy()
Long2ObjectMapcopy in interface Long2ObjectMap<V>copy in class AbstractLong2ObjectMap<V>public ObjectSet<Long2ObjectMap.Entry<V>> long2ObjectEntrySet()
Long2ObjectMaplong2ObjectEntrySet in interface Long2ObjectMap<V>public LongSet keySet()
keySet in interface java.util.Map<java.lang.Long,V>keySet in interface Long2ObjectMap<V>keySet in class AbstractLong2ObjectMap<V>public ObjectCollection<V> values()
values in interface java.util.Map<java.lang.Long,V>values in interface Long2ObjectMap<V>values in class AbstractLong2ObjectMap<V>public void forEach(LongObjectConsumer<V> action)
Long2ObjectMapforEach in interface Long2ObjectMap<V>forEach in class AbstractLong2ObjectMap<V>action - processor of the values that are iterator overpublic boolean replace(long key,
V oldValue,
V newValue)
Long2ObjectMapreplace in interface Long2ObjectMap<V>replace in class AbstractLong2ObjectMap<V>key - the element that should be searched foroldValue - the expected value to be replacednewValue - the value to replace the oldValue with.public V replace(long key, V value)
Long2ObjectMapreplace in interface Long2ObjectMap<V>replace in class AbstractLong2ObjectMap<V>key - the element that should be searched forvalue - the value to replace with.public V compute(long key, LongObjectUnaryOperator<V> mappingFunction)
Long2ObjectMapcompute in interface Long2ObjectMap<V>compute in class AbstractLong2ObjectMap<V>key - the key that should be computedmappingFunction - the operator that should generate the valuepublic V computeIfAbsent(long key, LongFunction<V> mappingFunction)
Long2ObjectMapcomputeIfAbsent in interface Long2ObjectMap<V>computeIfAbsent in class AbstractLong2ObjectMap<V>key - the key that should be computedmappingFunction - the operator that should generate the value if not presentpublic V supplyIfAbsent(long key, ObjectSupplier<V> valueProvider)
Long2ObjectMapsupplyIfAbsent in interface Long2ObjectMap<V>supplyIfAbsent in class AbstractLong2ObjectMap<V>key - the key that should be computedvalueProvider - the value if not presentpublic V computeIfPresent(long key, LongObjectUnaryOperator<V> mappingFunction)
Long2ObjectMapcomputeIfPresent in interface Long2ObjectMap<V>computeIfPresent in class AbstractLong2ObjectMap<V>key - the key that should be computedmappingFunction - the operator that should generate the value if presentpublic V merge(long key, V value, ObjectObjectUnaryOperator<V,V> mappingFunction)
Long2ObjectMapmerge in interface Long2ObjectMap<V>merge in class AbstractLong2ObjectMap<V>key - the key that should be be searched forvalue - the value that should be merged withmappingFunction - the operator that should generate the new Valuepublic void mergeAll(Long2ObjectMap<V> m, ObjectObjectUnaryOperator<V,V> mappingFunction)
Long2ObjectMapmergeAll in interface Long2ObjectMap<V>mergeAll in class AbstractLong2ObjectMap<V>m - the entries that should be bulk addedmappingFunction - the operator that should generate the new Valuepublic int size()
public void clear()
public boolean trim(int size)
ITrimmabletrim in interface ITrimmablesize - the requested trim size.public void clearAndTrim(int size)
ITrimmableclearAndTrim in interface ITrimmablesize - the amount of elements that should be allowed