Class CustomMap<K,V>

java.lang.Object
org.ujorm.tools.set.CustomMap<K,V>
All Implemented Interfaces:
Serializable, Map<K,V>

public class CustomMap<K,V> extends Object implements Map<K,V>, Serializable
Implementation of the Map interface where methods hash() and equals() can be customized for all the Map.
Author:
Pavel Ponec
See Also:
  • Constructor Details

    • CustomMap

      public CustomMap()
      The same mapper as a HashMap
    • CustomMap

      public CustomMap(@NotNull @NotNull Function<K,MapKeyProxy<K>> keyFactory)
      Mapper with a required equals and hasCode maker
    • CustomMap

      public CustomMap(@NotNull @NotNull HashMap<MapKeyProxy<K>,V> impl, @NotNull @NotNull Function<K,MapKeyProxy<K>> keyFactory)
      Full configuration mapper
  • Method Details

    • size

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

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

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

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

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

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

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

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

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

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

      public Set<MapKeyProxy<K>> keySetProxy()
      Returns a set fo the proxy key
    • values

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

      public Set<Map.Entry<K,V>> entrySet()
      Deprecated.
      Method is not implemented yet.
      Specified by:
      entrySet in interface Map<K,V>