Class SelfExpiringHashMap<K,V>

java.lang.Object
me.despical.commandframework.utils.SelfExpiringHashMap<K,V>
All Implemented Interfaces:
Map<K,V>, SelfExpiringMap<K,V>

@Internal public class SelfExpiringHashMap<K,V> extends Object implements SelfExpiringMap<K,V>
Author:
Despical

Created at 6.02.2024

  • Constructor Details

    • SelfExpiringHashMap

      public SelfExpiringHashMap()
  • Method Details

    • put

      public V put(K key, V value, long lifeTimeMs)
      Associates the specified value with the specified key in this map. If the map previously contained a mapping for the key, the old value is replaced.
      Specified by:
      put in interface SelfExpiringMap<K,V>
      Parameters:
      key - key with which the specified value is to be associated
      value - value to be associated with the specified key
      lifeTimeMs - how many milliseconds should the key live
      Returns:
      the previous value associated with key, or null if there was no mapping for key. (A null return can also indicate that the map previously associated null with key.)
    • put

      public V put(K key, V value)
      Specified by:
      put in interface Map<K,V>
    • containsKey

      public boolean containsKey(Object key)
      Specified by:
      containsKey in interface Map<K,V>
    • get

      public V get(Object key)
      Specified by:
      get in interface Map<K,V>
    • remove

      public V remove(Object key)
      Specified by:
      remove in interface Map<K,V>
    • size

      public int size()
      Specified by:
      size in interface Map<K,V>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Map<K,V>
    • containsValue

      public boolean containsValue(Object value)
      Specified by:
      containsValue in interface Map<K,V>
    • putAll

      public void putAll(@NotNull @NotNull Map<? extends K,? extends V> map)
      Specified by:
      putAll in interface Map<K,V>
    • clear

      public void clear()
      Specified by:
      clear in interface Map<K,V>
    • keySet

      @NotNull public @NotNull Set<K> keySet()
      Specified by:
      keySet in interface Map<K,V>
    • values

      @NotNull public @NotNull Collection<V> values()
      Specified by:
      values in interface Map<K,V>
    • entrySet

      @NotNull public @NotNull Set<Map.Entry<K,V>> entrySet()
      Specified by:
      entrySet in interface Map<K,V>