Class BoundedLinkedHashMap<K,V>

java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<K,V>
software.amazon.awssdk.utils.internal.BoundedLinkedHashMap<K,V>
All Implemented Interfaces:
Serializable, Cloneable, Map<K,V>

@SdkInternalApi public final class BoundedLinkedHashMap<K,V> extends LinkedHashMap<K,V>
A bounded linked hash map that would remove the eldest entry when the map size exceeds a configurable maximum.
See Also:
  • Constructor Details

    • BoundedLinkedHashMap

      public BoundedLinkedHashMap(int maxSize)
  • Method Details

    • removeEldestEntry

      protected boolean removeEldestEntry(Map.Entry<K,V> eldest)

      Returns true if the size of this map exceeds the maximum.

      Overrides:
      removeEldestEntry in class LinkedHashMap<K,V>
    • getMaxSize

      public int getMaxSize()
      Returns the maximum size of this map beyond which the eldest entry will get removed.