T - the keyType of elements maintained by this Collectionpublic class Enum2LongMap<T extends java.lang.Enum<T>> extends AbstractObject2LongMap<T>
AbstractObject2LongMap.BasicEntry<T>java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>Object2LongMap.BuilderCache<T>, Object2LongMap.Entry<T>, Object2LongMap.FastEntrySet<T>, Object2LongMap.MapBuilder| Constructor and Description |
|---|
Enum2LongMap(java.lang.Class<T> keyType)
Default Constructor
|
Enum2LongMap(java.util.Map<? extends T,? extends java.lang.Long> map)
A Helper constructor that allows to create a EnumMap with exactly the same values as the provided map.
|
Enum2LongMap(Object2LongMap<T> map)
A Type Specific Helper function that allows to create a new EnumMap with exactly the same values as the provided map.
|
Enum2LongMap(T[] keys,
long[] values)
Helper constructor that allow to create a EnumMap from unboxed values
|
Enum2LongMap(T[] keys,
java.lang.Long[] values)
Helper constructor that allow to create a EnumMap from boxed values (it will unbox them)
|
| Modifier and Type | Method and Description |
|---|---|
long |
addTo(T key,
long value)
A Helper method to add a primitives together.
|
void |
clear() |
long |
computeLong(T key,
ObjectLongUnaryOperator<T> mappingFunction)
A Type Specific compute method to reduce boxing/unboxing
|
long |
computeLongIfAbsent(T key,
ToLongFunction<T> mappingFunction)
A Type Specific compute method to reduce boxing/unboxing
|
long |
computeLongIfPresent(T key,
ObjectLongUnaryOperator<T> mappingFunction)
A Type Specific compute method to reduce boxing/unboxing
|
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(long value)
Type Specific method to reduce boxing/unboxing of values
|
Enum2LongMap<T> |
copy()
A Function that does a shallow clone of the Map itself.
|
void |
forEach(ObjectLongConsumer<T> action)
Type Specific forEach method to reduce boxing/unboxing
|
long |
getLong(T key)
A Type Specific get method to reduce boxing/unboxing
|
long |
getOrDefault(T key,
long defaultValue)
A Type Specific getOrDefault method to reduce boxing/unboxing
|
ObjectSet<T> |
keySet() |
void |
mergeAllLong(Object2LongMap<T> m,
LongLongUnaryOperator mappingFunction)
A Bulk method for merging Maps.
|
long |
mergeLong(T key,
long value,
LongLongUnaryOperator mappingFunction)
A Type Specific merge method to reduce boxing/unboxing
|
ObjectSet<Object2LongMap.Entry<T>> |
object2LongEntrySet()
Type Sensitive EntrySet to reduce boxing/unboxing and optionally Temp Object Allocation.
|
long |
put(T key,
long value)
Type Specific method to reduce boxing/unboxing of values
|
long |
putIfAbsent(T key,
long value)
Type Specific method to reduce boxing/unboxing of values
|
long |
rem(T key)
Type Specific remove function to reduce boxing/unboxing
|
long |
remOrDefault(T key,
long defaultValue)
Type-Specific Remove function with a default return value if wanted.
|
java.lang.Long |
remove(java.lang.Object key) |
boolean |
remove(T key,
long value)
Type Specific remove function to reduce boxing/unboxing
|
long |
replace(T key,
long value)
A Type Specific replace method to reduce boxing/unboxing replace an existing value
|
boolean |
replace(T key,
long oldValue,
long newValue)
A Type Specific replace method to replace an existing value
|
int |
size() |
long |
subFrom(T key,
long value)
A Helper method to subtract from primitive from each other.
|
long |
supplyLongIfAbsent(T key,
LongSupplier valueProvider)
A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
LongCollection |
values() |
addToAll, entrySet, equals, get, getDefaultReturnValue, getOrDefault, hashCode, put, putAll, putAll, putAll, putAll, putAllIfAbsent, replaceLongs, replaceLongs, setDefaultReturnValueapplyAsLong, builder, compute, computeIfAbsent, computeIfPresent, containsValue, forEach, merge, put, put, putAll, putAll, putIfAbsent, remove, replace, replace, replaceAll, synchronize, synchronize, unmodifiablepublic Enum2LongMap(java.lang.Class<T> keyType)
keyType - the type of Enum that should be usedpublic Enum2LongMap(T[] keys, java.lang.Long[] values)
keys - the keys that should be put into the EnumMapvalues - the values that should be put into the EnumMap.java.lang.IllegalStateException - if the keys and values do not match in lenghtpublic Enum2LongMap(T[] keys, long[] 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 Enum2LongMap(java.util.Map<? extends T,? extends java.lang.Long> map)
map - the values that should be present in the mappublic Enum2LongMap(Object2LongMap<T> map)
map - the values that should be present in the mappublic long put(T key, long value)
Object2LongMapkey - the key that should be inserted,value - the value that should be insertedMap.put(Object, Object)public long putIfAbsent(T key, long value)
Object2LongMapkey - the key that should be inserted,value - the value that should be insertedMap.putIfAbsent(Object, Object)public long addTo(T key, long value)
Object2LongMapkey - the key that should be inserted,value - the value that should be inserted / addedpublic long subFrom(T key, long value)
Object2LongMapObject2LongMap.getDefaultReturnValue()
If the fence is reached the element will be automaticall removedkey - that should be subtract fromvalue - that should be subtractpublic boolean containsKey(java.lang.Object key)
containsKey in interface java.util.Map<T extends java.lang.Enum<T>,java.lang.Long>containsKey in class AbstractObject2LongMap<T extends java.lang.Enum<T>>public boolean containsValue(long value)
Object2LongMapcontainsValue in interface Object2LongMap<T extends java.lang.Enum<T>>containsValue in class AbstractObject2LongMap<T extends java.lang.Enum<T>>value - element that is searched forpublic java.lang.Long remove(java.lang.Object key)
remove in interface java.util.Map<T extends java.lang.Enum<T>,java.lang.Long>remove in interface Object2LongMap<T extends java.lang.Enum<T>>remove in class AbstractObject2LongMap<T extends java.lang.Enum<T>>key - the element that should be removedMap.remove(Object)public long rem(T key)
Object2LongMapkey - the element that should be removedpublic long remOrDefault(T key, long defaultValue)
Object2LongMapkey - the element that should be removeddefaultValue - the value that should be returned if the entry doesn't existMap.remove(Object, Object)public boolean remove(T key, long value)
Object2LongMapkey - the element that should be removedvalue - the expected value that should be foundMap.remove(Object, Object)public long getLong(T key)
Object2LongMapkey - the key that is searched forpublic long getOrDefault(T key, long defaultValue)
Object2LongMapkey - the key that is searched fordefaultValue - the value that should be returned if the key is not presentpublic Enum2LongMap<T> copy()
Object2LongMapcopy in interface Object2LongMap<T extends java.lang.Enum<T>>copy in class AbstractObject2LongMap<T extends java.lang.Enum<T>>public ObjectSet<Object2LongMap.Entry<T>> object2LongEntrySet()
Object2LongMappublic ObjectSet<T> keySet()
keySet in interface java.util.Map<T extends java.lang.Enum<T>,java.lang.Long>keySet in interface Object2LongMap<T extends java.lang.Enum<T>>keySet in class AbstractObject2LongMap<T extends java.lang.Enum<T>>public LongCollection values()
values in interface java.util.Map<T extends java.lang.Enum<T>,java.lang.Long>values in interface Object2LongMap<T extends java.lang.Enum<T>>values in class AbstractObject2LongMap<T extends java.lang.Enum<T>>public void forEach(ObjectLongConsumer<T> action)
Object2LongMapforEach in interface Object2LongMap<T extends java.lang.Enum<T>>forEach in class AbstractObject2LongMap<T extends java.lang.Enum<T>>action - processor of the values that are iterator overpublic boolean replace(T key, long oldValue, long newValue)
Object2LongMapreplace in interface Object2LongMap<T extends java.lang.Enum<T>>replace in class AbstractObject2LongMap<T extends java.lang.Enum<T>>key - the element that should be searched foroldValue - the expected value to be replacednewValue - the value to replace the oldValue with.public long replace(T key, long value)
Object2LongMapreplace in interface Object2LongMap<T extends java.lang.Enum<T>>replace in class AbstractObject2LongMap<T extends java.lang.Enum<T>>key - the element that should be searched forvalue - the value to replace with.public long computeLong(T key, ObjectLongUnaryOperator<T> mappingFunction)
Object2LongMapcomputeLong in interface Object2LongMap<T extends java.lang.Enum<T>>computeLong in class AbstractObject2LongMap<T extends java.lang.Enum<T>>key - the key that should be computedmappingFunction - the operator that should generate the valuepublic long computeLongIfAbsent(T key, ToLongFunction<T> mappingFunction)
Object2LongMapcomputeLongIfAbsent in interface Object2LongMap<T extends java.lang.Enum<T>>computeLongIfAbsent in class AbstractObject2LongMap<T extends java.lang.Enum<T>>key - the key that should be computedmappingFunction - the operator that should generate the value if not presentpublic long supplyLongIfAbsent(T key, LongSupplier valueProvider)
Object2LongMapsupplyLongIfAbsent in interface Object2LongMap<T extends java.lang.Enum<T>>supplyLongIfAbsent in class AbstractObject2LongMap<T extends java.lang.Enum<T>>key - the key that should be computedvalueProvider - the value if not presentpublic long computeLongIfPresent(T key, ObjectLongUnaryOperator<T> mappingFunction)
Object2LongMapcomputeLongIfPresent in interface Object2LongMap<T extends java.lang.Enum<T>>computeLongIfPresent in class AbstractObject2LongMap<T extends java.lang.Enum<T>>key - the key that should be computedmappingFunction - the operator that should generate the value if presentpublic long mergeLong(T key, long value, LongLongUnaryOperator mappingFunction)
Object2LongMapmergeLong in interface Object2LongMap<T extends java.lang.Enum<T>>mergeLong in class AbstractObject2LongMap<T extends java.lang.Enum<T>>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 mergeAllLong(Object2LongMap<T> m, LongLongUnaryOperator mappingFunction)
Object2LongMapmergeAllLong in interface Object2LongMap<T extends java.lang.Enum<T>>mergeAllLong in class AbstractObject2LongMap<T extends java.lang.Enum<T>>m - the entries that should be bulk addedmappingFunction - the operator that should generate the new Valuepublic void clear()