Class KeyCollectionAsMap<K,E>

java.lang.Object
org.magicwerk.brownies.collections.KeyCollectionAsMap<K,E>
All Implemented Interfaces:
Serializable, Map<K,E>

public class KeyCollectionAsMap<K,E> extends Object implements Map<K,E>, Serializable
Implements a Map based on a key map in a KeyCollection or KeyList.
See Also:
  • Field Details

    • coll

      Reference to KeyCollectionImpl containing data (exactly one of the fields coll and list is set)
    • list

      KeyListImpl<E> list
      Reference to KeyListImpl containing data (exactly one of the fields coll and list is set)
    • keyIndex

      int keyIndex
    • immutable

      boolean immutable
  • Constructor Details

    • KeyCollectionAsMap

      public KeyCollectionAsMap(KeyCollectionImpl<E> coll, int keyIndex, boolean immutable)
    • KeyCollectionAsMap

      public KeyCollectionAsMap(KeyListImpl<E> list, int keyIndex, boolean immutable)
  • Method Details

    • equals

      public boolean equals(Object o)
      Specified by:
      equals in interface Map<K,E>
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Map<K,E>
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • size

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

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

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

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

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

      public Set<K> keySet()

      Note that the returned set is immutable.

      Specified by:
      keySet in interface Map<K,E>
    • entrySet

      public Set<Map.Entry<K,E>> entrySet()

      Note that the returned set is immutable.

      Specified by:
      entrySet in interface Map<K,E>
    • values

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

      void checkMutable()
    • clear

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

      public E put(K key, E elem)
      Specified by:
      put in interface Map<K,E>
    • remove

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

      public void putAll(Map<? extends K,? extends E> map)
      Specified by:
      putAll in interface Map<K,E>