T - the type of elements maintained by this Collectionpublic class Enum2IntMap<T extends java.lang.Enum<T>> extends AbstractObject2IntMap<T>
AbstractObject2IntMap.BasicEntry<T>java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>Object2IntMap.BuilderCache<T>, Object2IntMap.Entry<T>, Object2IntMap.FastEntrySet<T>, Object2IntMap.MapBuilder| Constructor and Description |
|---|
Enum2IntMap(java.lang.Class<T> keyType)
Default Constructor
|
Enum2IntMap(java.util.Map<? extends T,? extends java.lang.Integer> map)
A Helper constructor that allows to create a EnumMap with exactly the same values as the provided map.
|
Enum2IntMap(Object2IntMap<T> map)
A Type Specific Helper function that allows to create a new EnumMap with exactly the same values as the provided map.
|
Enum2IntMap(T[] keys,
int[] values)
Helper constructor that allow to create a EnumMap from unboxed values
|
Enum2IntMap(T[] keys,
java.lang.Integer[] values)
Helper constructor that allow to create a EnumMap from boxed values (it will unbox them)
|
| Modifier and Type | Method and Description |
|---|---|
int |
addTo(T key,
int value)
A Helper method to add a primitives together.
|
void |
clear() |
int |
computeInt(T key,
ObjectIntUnaryOperator<T> mappingFunction)
A Type Specific compute method to reduce boxing/unboxing
|
int |
computeIntIfAbsent(T key,
Object2IntFunction<T> mappingFunction)
A Type Specific compute method to reduce boxing/unboxing
|
int |
computeIntIfPresent(T key,
ObjectIntUnaryOperator<T> mappingFunction)
A Type Specific compute method to reduce boxing/unboxing
|
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(int value)
Type Specific method to reduce boxing/unboxing of values
|
Enum2IntMap<T> |
copy()
A Function that does a shallow clone of the Map itself.
|
void |
forEach(ObjectIntConsumer<T> action)
Type Specific forEach method to reduce boxing/unboxing
|
int |
getInt(T key)
A Type Specific get method to reduce boxing/unboxing
|
int |
getOrDefault(T key,
int defaultValue)
A Type Specific getOrDefault method to reduce boxing/unboxing
|
ObjectSet<T> |
keySet() |
void |
mergeAllInt(Object2IntMap<T> m,
IntIntUnaryOperator mappingFunction)
A Bulk method for merging Maps.
|
int |
mergeInt(T key,
int value,
IntIntUnaryOperator mappingFunction)
A Type Specific merge method to reduce boxing/unboxing
|
ObjectSet<Object2IntMap.Entry<T>> |
object2IntEntrySet()
Type Sensitive EntrySet to reduce boxing/unboxing and optionally Temp Object Allocation.
|
int |
put(T key,
int value)
Type Specific method to reduce boxing/unboxing of values
|
int |
putIfAbsent(T key,
int value)
Type Specific method to reduce boxing/unboxing of values
|
int |
rem(T key)
Type Specific remove function to reduce boxing/unboxing
|
int |
remOrDefault(T key,
int defaultValue)
Type-Specific Remove function with a default return value if wanted.
|
java.lang.Integer |
remove(java.lang.Object key) |
boolean |
remove(T key,
int value)
Type Specific remove function to reduce boxing/unboxing
|
int |
replace(T key,
int value)
A Type Specific replace method to reduce boxing/unboxing replace an existing value
|
boolean |
replace(T key,
int oldValue,
int newValue)
A Type Specific replace method to replace an existing value
|
int |
size() |
int |
subFrom(T key,
int value)
A Helper method to subtract from primitive from each other.
|
int |
supplyIntIfAbsent(T key,
IntSupplier valueProvider)
A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
IntCollection |
values() |
addToAll, entrySet, equals, get, getDefaultReturnValue, getOrDefault, hashCode, put, putAll, putAll, putAll, putAll, putAllIfAbsent, replaceInts, replaceInts, setDefaultReturnValuebuilder, compute, computeIfAbsent, computeIfPresent, containsValue, forEach, merge, putAll, putAll, putIfAbsent, remove, replace, replace, replaceAll, synchronize, synchronize, unmodifiableapplyAsIntpublic Enum2IntMap(java.lang.Class<T> keyType)
keyType - the type of Enum that should be usedpublic Enum2IntMap(T[] keys, java.lang.Integer[] 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 Enum2IntMap(T[] keys, int[] 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 Enum2IntMap(java.util.Map<? extends T,? extends java.lang.Integer> map)
map - the values that should be present in the mappublic Enum2IntMap(Object2IntMap<T> map)
map - the values that should be present in the mappublic int put(T key, int value)
Object2IntMapkey - the key that should be inserted,value - the value that should be insertedMap.put(Object, Object)public int putIfAbsent(T key, int value)
Object2IntMapkey - the key that should be inserted,value - the value that should be insertedMap.putIfAbsent(Object, Object)public int addTo(T key, int value)
Object2IntMapkey - the key that should be inserted,value - the value that should be inserted / addedpublic int subFrom(T key, int value)
Object2IntMapObject2IntMap.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.Integer>containsKey in class AbstractObject2IntMap<T extends java.lang.Enum<T>>public boolean containsValue(int value)
Object2IntMapcontainsValue in interface Object2IntMap<T extends java.lang.Enum<T>>containsValue in class AbstractObject2IntMap<T extends java.lang.Enum<T>>value - element that is searched forpublic java.lang.Integer remove(java.lang.Object key)
remove in interface java.util.Map<T extends java.lang.Enum<T>,java.lang.Integer>remove in interface Object2IntMap<T extends java.lang.Enum<T>>remove in class AbstractObject2IntMap<T extends java.lang.Enum<T>>key - the element that should be removedMap.remove(Object)public int rem(T key)
Object2IntMapkey - the element that should be removedpublic int remOrDefault(T key, int defaultValue)
Object2IntMapkey - 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, int value)
Object2IntMapkey - the element that should be removedvalue - the expected value that should be foundMap.remove(Object, Object)public int getInt(T key)
Object2IntMapkey - the key that is searched forpublic int getOrDefault(T key, int defaultValue)
Object2IntMapkey - the key that is searched fordefaultValue - the value that should be returned if the key is not presentpublic Enum2IntMap<T> copy()
Object2IntMapcopy in interface Object2IntMap<T extends java.lang.Enum<T>>copy in class AbstractObject2IntMap<T extends java.lang.Enum<T>>public ObjectSet<Object2IntMap.Entry<T>> object2IntEntrySet()
Object2IntMappublic ObjectSet<T> keySet()
keySet in interface java.util.Map<T extends java.lang.Enum<T>,java.lang.Integer>keySet in interface Object2IntMap<T extends java.lang.Enum<T>>keySet in class AbstractObject2IntMap<T extends java.lang.Enum<T>>public IntCollection values()
values in interface java.util.Map<T extends java.lang.Enum<T>,java.lang.Integer>values in interface Object2IntMap<T extends java.lang.Enum<T>>values in class AbstractObject2IntMap<T extends java.lang.Enum<T>>public void forEach(ObjectIntConsumer<T> action)
Object2IntMapforEach in interface Object2IntMap<T extends java.lang.Enum<T>>forEach in class AbstractObject2IntMap<T extends java.lang.Enum<T>>action - processor of the values that are iterator overpublic boolean replace(T key, int oldValue, int newValue)
Object2IntMapreplace in interface Object2IntMap<T extends java.lang.Enum<T>>replace in class AbstractObject2IntMap<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 int replace(T key, int value)
Object2IntMapreplace in interface Object2IntMap<T extends java.lang.Enum<T>>replace in class AbstractObject2IntMap<T extends java.lang.Enum<T>>key - the element that should be searched forvalue - the value to replace with.public int computeInt(T key, ObjectIntUnaryOperator<T> mappingFunction)
Object2IntMapcomputeInt in interface Object2IntMap<T extends java.lang.Enum<T>>computeInt in class AbstractObject2IntMap<T extends java.lang.Enum<T>>key - the key that should be computedmappingFunction - the operator that should generate the valuepublic int computeIntIfAbsent(T key, Object2IntFunction<T> mappingFunction)
Object2IntMapcomputeIntIfAbsent in interface Object2IntMap<T extends java.lang.Enum<T>>computeIntIfAbsent in class AbstractObject2IntMap<T extends java.lang.Enum<T>>key - the key that should be computedmappingFunction - the operator that should generate the value if not presentpublic int supplyIntIfAbsent(T key, IntSupplier valueProvider)
Object2IntMapsupplyIntIfAbsent in interface Object2IntMap<T extends java.lang.Enum<T>>supplyIntIfAbsent in class AbstractObject2IntMap<T extends java.lang.Enum<T>>key - the key that should be computedvalueProvider - the value if not presentpublic int computeIntIfPresent(T key, ObjectIntUnaryOperator<T> mappingFunction)
Object2IntMapcomputeIntIfPresent in interface Object2IntMap<T extends java.lang.Enum<T>>computeIntIfPresent in class AbstractObject2IntMap<T extends java.lang.Enum<T>>key - the key that should be computedmappingFunction - the operator that should generate the value if presentpublic int mergeInt(T key, int value, IntIntUnaryOperator mappingFunction)
Object2IntMapmergeInt in interface Object2IntMap<T extends java.lang.Enum<T>>mergeInt in class AbstractObject2IntMap<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 mergeAllInt(Object2IntMap<T> m, IntIntUnaryOperator mappingFunction)
Object2IntMapmergeAllInt in interface Object2IntMap<T extends java.lang.Enum<T>>mergeAllInt in class AbstractObject2IntMap<T extends java.lang.Enum<T>>m - the entries that should be bulk addedmappingFunction - the operator that should generate the new Valuepublic void clear()