Class DoubleMap<K,V>

java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
fr.andross.banitem.utils.DoubleMap<K,V>
All Implemented Interfaces:
Serializable, Cloneable, Map<K,V>
Direct Known Subclasses:
CustomItems, MetaItems

public class DoubleMap<K,V> extends HashMap<K,V>
A simple double map, used to handle custom and meta items.
Version:
3.1
Author:
Andross
See Also:
  • Constructor Details

    • DoubleMap

      public DoubleMap()
  • Method Details

    • put

      public V put(@NotNull K key, @Nullable V value)
      Adding in both maps
      Specified by:
      put in interface Map<K,V>
      Overrides:
      put in class HashMap<K,V>
      Parameters:
      key - key
      value - value
      See Also:
    • clear

      public void clear()
      Will clear the map and its reversed one
      Specified by:
      clear in interface Map<K,V>
      Overrides:
      clear in class HashMap<K,V>
    • remove

      public V remove(@NotNull Object key)
      Remove the key from both maps
      Specified by:
      remove in interface Map<K,V>
      Overrides:
      remove in class HashMap<K,V>
      Parameters:
      key - key
      See Also:
    • getKey

      @Nullable public K getKey(@NotNull V value)
      Get the key of this value from the reversed map
      Parameters:
      value - value
      Returns:
      the key of this value if exists, otherwise null
    • getReversed

      @NotNull public Map<V,K> getReversed()
      Get the reversed map
      Returns:
      the reversed map