Package 

Class MaxSizeHashMap

  • All Implemented Interfaces:
    java.io.Serializable , java.lang.Cloneable , java.util.Map , java.util.SequencedMap

    
    public class MaxSizeHashMap<K, V>
    extends LinkedHashMap<K, V>
                        

    This is a specialized java.util.HashMap. Whenever the size of this hashmap grows to it's maximum size, It will automatically remove the oldest element from the map. The definition of the oldest element is either can be determined by map entry time or access time.

    • Constructor Summary

      Constructors 
      Constructor Description
      MaxSizeHashMap(int maxSize) Constructor
    • Method Summary

      Modifier and Type Method Description
      • Methods inherited from class java.util.LinkedHashMap

        clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, newLinkedHashMap, putFirst, putLast, replaceAll, reversed, sequencedEntrySet, sequencedKeySet, sequencedValues, values
      • Methods inherited from class java.util.HashMap

        clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, newHashMap, put, putAll, putIfAbsent, remove, remove, replace, replace, size
      • Methods inherited from class java.util.AbstractMap

        equals, hashCode, toString
      • Methods inherited from class java.util.Map

        copyOf, entry, of, ofEntries
      • Methods inherited from class java.util.SequencedMap

        firstEntry, lastEntry, pollFirstEntry, pollLastEntry
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MaxSizeHashMap

        MaxSizeHashMap(int maxSize)
        Constructor
        Parameters:
        maxSize - Maximum allowed size for this map.