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 void
clear()
V
compute(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
V
computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)
V
computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
boolean
containsKey(Object key)
boolean
containsValue(Object value)
Set<Map.Entry<K,V>>
entrySet()
boolean
equals(Object o)
void
forEach(BiConsumer<? super K,? super V> action)
V
get(Object key)
V
getOrDefault(Object key, V defaultValue)
int
hashCode()
boolean
isEmpty()
Set<K>
keySet()
V
merge(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.V
put(K key, V value)
void
putAll(Map<? extends K,? extends V> m)
V
putIfAbsent(K key, V value)
V
remove(Object key)
boolean
remove(Object key, Object value)
V
replace(K key, V value)
boolean
replace(K key, V oldValue, V newValue)
void
replaceAll(BiFunction<? super K,? super V,? extends V> function)
int
size()
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:
containsKey
in interfaceMap<K,V>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValue
in interfaceMap<K,V>
-
equals
public boolean equals(Object o)
-
hashCode
public int hashCode()
-
getOrDefault
public V getOrDefault(Object key, V defaultValue)
- Specified by:
getOrDefault
in 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:
replaceAll
in interfaceMap<K,V>
-
computeIfAbsent
public V computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)
- Specified by:
computeIfAbsent
in interfaceMap<K,V>
-
computeIfPresent
public V computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
- Specified by:
computeIfPresent
in interfaceMap<K,V>
-
-