Package org.apache.ignite.internal.util
Class GridBoundedLinkedHashMap<K,V>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<K,V>
-
- java.util.LinkedHashMap<K,V>
-
- org.apache.ignite.internal.util.GridBoundedLinkedHashMap<K,V>
-
- Type Parameters:
K- Map key.V- Map entry.
- All Implemented Interfaces:
Serializable,Cloneable,Map<K,V>
public class GridBoundedLinkedHashMap<K,V> extends LinkedHashMap<K,V>
Generic map with an upper bound. Once map reaches its maximum capacity, the eldest elements will be removed based on insertion order.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Constructor Summary
Constructors Constructor Description GridBoundedLinkedHashMap(int maxCap)Constructs an empty insertion-orderedGridBoundedLinkedHashMapinstance with the specified maximum capacity, and a default load factor (0.75).GridBoundedLinkedHashMap(int initCap, int maxCap)Constructs an empty insertion-orderedGridBoundedLinkedHashMapinstance with the specified initial capacity, maximum capacity, and a default load factor (0.75).GridBoundedLinkedHashMap(int initCap, int maxCap, float loadFactor)Constructs an empty insertion-orderedGridBoundedLinkedHashMapinstance with the specified initial capacity, maximum capacity, and load factor.GridBoundedLinkedHashMap(int initCap, int maxCap, float loadFactor, boolean accessOrder)Constructs an emptyGridBoundedLinkedHashMapinstance with the specified initial capacity, maximum capacity, load factor and ordering mode.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectclone()protected booleanremoveEldestEntry(Map.Entry<K,V> eldest)-
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, values
-
Methods inherited from class java.util.HashMap
compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
-
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
-
-
-
-
Constructor Detail
-
GridBoundedLinkedHashMap
public GridBoundedLinkedHashMap(int maxCap) throws IllegalArgumentExceptionConstructs an empty insertion-orderedGridBoundedLinkedHashMapinstance with the specified maximum capacity, and a default load factor (0.75).- Parameters:
maxCap- Maximum map capacity.- Throws:
IllegalArgumentException- If the maximum capacity is negative.
-
GridBoundedLinkedHashMap
public GridBoundedLinkedHashMap(int initCap, int maxCap) throws IllegalArgumentExceptionConstructs an empty insertion-orderedGridBoundedLinkedHashMapinstance with the specified initial capacity, maximum capacity, and a default load factor (0.75).- Parameters:
initCap- Initial map capacity.maxCap- Maximum map capacity.- Throws:
IllegalArgumentException- If the initial capacity is negative, or maximum capacity is smaller than initial capacity.
-
GridBoundedLinkedHashMap
public GridBoundedLinkedHashMap(int initCap, int maxCap, float loadFactor) throws IllegalArgumentExceptionConstructs an empty insertion-orderedGridBoundedLinkedHashMapinstance with the specified initial capacity, maximum capacity, and load factor.- Parameters:
initCap- Initial map capacity.maxCap- Maximum map capacity.loadFactor- Load factor.- Throws:
IllegalArgumentException- If the initial capacity is negative, the load factor is non-positive, or maximum capacity is smaller than initial capacity.
-
GridBoundedLinkedHashMap
public GridBoundedLinkedHashMap(int initCap, int maxCap, float loadFactor, boolean accessOrder) throws IllegalArgumentExceptionConstructs an emptyGridBoundedLinkedHashMapinstance with the specified initial capacity, maximum capacity, load factor and ordering mode.- Parameters:
initCap- Initial map capacity.maxCap- Maximum map capacity.loadFactor- Load factor.accessOrder- The ordering mode -truefor access-order,falsefor insertion-order.- Throws:
IllegalArgumentException- If the initial capacity is negative, the load factor is non-positive, or maximum capacity is smaller than initial capacity.
-
-