Package proguard.analysis.cpa.defaults
Class LimitedHashMap<K,V>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<K,V>
-
- proguard.analysis.cpa.defaults.LimitedHashMap<K,V>
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.util.Map<K,V>
- Direct Known Subclasses:
LimitedHashMapAbstractState
public class LimitedHashMap<K,V> extends java.util.HashMap<K,V>
ThisLimitedHashMap
is aHashMap
which limits its content based on the functionremoveElement
.removeElement
determines whether the map limit is reached. If it returns an empty value, the map behaves as usual. Otherwise, the returned key is removed from the map.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected TriFunction<LimitedHashMap<K,V>,K,V,java.util.Optional<K>>
removeElement
-
Constructor Summary
Constructors Constructor Description LimitedHashMap(int initialCapacity, TriFunction<LimitedHashMap<K,V>,K,V,java.util.Optional<K>> removeElement)
Create an empty limited map with reserved initial capacity.LimitedHashMap(java.util.Map<? extends K,? extends V> m, TriFunction<LimitedHashMap<K,V>,K,V,java.util.Optional<K>> removeElement)
Create a limited map from another map and a tripredicate.LimitedHashMap(TriFunction<LimitedHashMap<K,V>,K,V,java.util.Optional<K>> removeElement)
Create an empty limited hash map.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description V
compute(K key, java.util.function.BiFunction<? super K,? super V,? extends V> remappingFunction)
V
computeIfAbsent(K key, java.util.function.Function<? super K,? extends V> mappingFunction)
V
merge(K key, V value, java.util.function.BiFunction<? super V,? super V,? extends V> remappingFunction)
V
put(K key, V value)
void
putAll(java.util.Map<? extends K,? extends V> m)
V
putIfAbsent(K key, V value)
-
Methods inherited from class java.util.HashMap
clear, clone, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, remove, remove, replace, replace, replaceAll, size, values
-
-
-
-
Field Detail
-
removeElement
protected TriFunction<LimitedHashMap<K,V>,K,V,java.util.Optional<K>> removeElement
-
-
Constructor Detail
-
LimitedHashMap
public LimitedHashMap(TriFunction<LimitedHashMap<K,V>,K,V,java.util.Optional<K>> removeElement)
Create an empty limited hash map.- Parameters:
removeElement
- determines whether the map limit is reached if it returns an empty value, the map behaves as usual otherwise, the returned key is removed from the map
-
LimitedHashMap
public LimitedHashMap(int initialCapacity, TriFunction<LimitedHashMap<K,V>,K,V,java.util.Optional<K>> removeElement)
Create an empty limited map with reserved initial capacity.- Parameters:
initialCapacity
- the initial capacity of the hash tableremoveElement
- determines whether the map limit is reached if it returns an empty value, the map behaves as usual otherwise, the returned key is removed from the map
-
LimitedHashMap
public LimitedHashMap(java.util.Map<? extends K,? extends V> m, TriFunction<LimitedHashMap<K,V>,K,V,java.util.Optional<K>> removeElement)
Create a limited map from another map and a tripredicate.- Parameters:
m
- map which elements are used for initializationremoveElement
- determines whether the map limit is reached if it returns an empty value, the map behaves as usual otherwise, the returned key is removed from the map
-
-
Method Detail
-
computeIfAbsent
public V computeIfAbsent(K key, java.util.function.Function<? super K,? extends V> mappingFunction)
-
compute
public V compute(K key, java.util.function.BiFunction<? super K,? super V,? extends V> remappingFunction)
-
-