Package dev.resteasy.client.util.common
Class LimitMap<K,V>
- java.lang.Object
-
- dev.resteasy.client.util.common.LimitMap<K,V>
-
- All Implemented Interfaces:
Map<K,V>
public class LimitMap<K,V> extends Object implements Map<K,V>
A simple map which limits the number of entries allowed.- Author:
- James R. Perkins
-
-
Constructor Summary
Constructors Constructor Description LimitMap(int limit)Creates a map which limits the entries.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Vcompute(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)VcomputeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)VcomputeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)booleancontainsKey(Object key)booleancontainsValue(Object value)Set<Map.Entry<K,V>>entrySet()booleanequals(Object o)voidforEach(BiConsumer<? super K,? super V> action)Vget(Object key)VgetOrDefault(Object key, V defaultValue)inthashCode()booleanisEmpty()Set<K>keySet()Vmerge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction)static <K,V>
LimitMap<K,V>of(int limit)Creates a map which limits the entries.Vput(K key, V value)voidputAll(Map<? extends K,? extends V> m)VputIfAbsent(K key, V value)Vremove(Object key)booleanremove(Object key, Object value)Vreplace(K key, V value)booleanreplace(K key, V oldValue, V newValue)voidreplaceAll(BiFunction<? super K,? super V,? extends V> function)intsize()Collection<V>values()
-
-
-
Method Detail
-
of
public static <K,V> LimitMap<K,V> of(int limit)
Creates a map which limits the entries.- Parameters:
limit- the maximum amount of entries allowed, must be greater than 0
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKeyin interfaceMap<K,V>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValuein interfaceMap<K,V>
-
equals
public boolean equals(Object o)
-
hashCode
public int hashCode()
-
getOrDefault
public V getOrDefault(Object key, V defaultValue)
- Specified by:
getOrDefaultin interfaceMap<K,V>
-
forEach
public void forEach(BiConsumer<? super K,? super V> action)
-
replaceAll
public void replaceAll(BiFunction<? super K,? super V,? extends V> function)
- Specified by:
replaceAllin interfaceMap<K,V>
-
computeIfAbsent
public V computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)
- Specified by:
computeIfAbsentin interfaceMap<K,V>
-
computeIfPresent
public V computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
- Specified by:
computeIfPresentin interfaceMap<K,V>
-
-