LinkedHashMap
and implement LinkedHashMap.removeEldestEntry(java.util.Map.Entry<K, V>)
to enforce a maximum number of entries.public class BoundedLinkedHashMap
extends java.util.LinkedHashMap
BoundedLinkedHashMap
is a bounded
LinkedHashMap
. The bound is the maximum
number of entries the BoundedLinkedHashMap
can contain.Modifier and Type | Field and Description |
---|---|
protected int |
_maximumNumberOfEntries
Deprecated.
The maximum number of entries allowed in this
BoundedLinkedHashMap |
Constructor and Description |
---|
BoundedLinkedHashMap(int maximumNumberOfEntries)
Deprecated.
Constructor.
|
BoundedLinkedHashMap(int initialCapacity,
float loadFactor,
int maximumNumberOfEntries)
Deprecated.
Constructor.
|
BoundedLinkedHashMap(int initialCapacity,
int maximumNumberOfEntries)
Deprecated.
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
getMaximumNumberOfEntries()
Deprecated.
Returns the maximum number of entries.
|
protected boolean |
removeEldestEntry(java.util.Map.Entry entry)
Deprecated.
|
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, values
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
protected int _maximumNumberOfEntries
BoundedLinkedHashMap
public BoundedLinkedHashMap(int initialCapacity, float loadFactor, int maximumNumberOfEntries)
initialCapacity
- The initial capacity.loadFactor
- The load factormaximumNumberOfEntries
- The maximum number of allowed entriespublic BoundedLinkedHashMap(int initialCapacity, int maximumNumberOfEntries)
initialCapacity
- The initial capacity.maximumNumberOfEntries
- The maximum number of allowed entriespublic BoundedLinkedHashMap(int maximumNumberOfEntries)
maximumNumberOfEntries
- The maximum number of allowed entriespublic int getMaximumNumberOfEntries()
protected boolean removeEldestEntry(java.util.Map.Entry entry)
removeEldestEntry
in class java.util.LinkedHashMap