Interface Mapped<K,V>

All Known Subinterfaces:
IListMap<K,V>, IMap<K,V>, IMultiset<T>, ISet<T>, ISetMap<K,V>
All Known Implementing Classes:
AbstractMap, AbstractMultiset, AbstractSet, AbstractSetUsingMap, EmptyHashMap, EmptyHashSet, HashListMap, HashMap, HashMultiset, HashSet, HashSetMap, OrderedListMap, OrderedMap, OrderedMultiset, OrderedSet, OrderedSetMap, TemplateSetMap, TreeListMap, TreeMap, TreeMultiset, TreeSet, TreeSetMap

public interface Mapped<K,V>
Interface for containers that associate keys with values.
  • Method Summary

    Modifier and Type
    Method
    Description
    find(K key)
    Return a Holder containing the value associated wth the key or an empty Holder if no value is associated with the key.
    get(K key)
    Return the value associated with key or null if no value is associated.
    getValueOr(K key, V defaultValue)
    Return the value associated with key or defaultValue if no value is associated.
  • Method Details

    • get

      @Nullable V get(K key)
      Return the value associated with key or null if no value is associated. Note that if null is an acceptable value to the container then this method will be ambiguous and find() should be used instead.
      Parameters:
      key - identifies the value to retrieve
      Returns:
      value associated with key or null if no value is associated
    • getValueOr

      V getValueOr(K key, V defaultValue)
      Return the value associated with key or defaultValue if no value is associated. Note that if defaultValue is an acceptable value to the container then this method will be ambiguous and find() should be used instead.
      Parameters:
      key - identifies the value to retrieve
      defaultValue - value to return if no entry exists for key
      Returns:
      value associated with key or defaultValue if no value is associated
    • find

      @Nonnull Maybe<V> find(K key)
      Return a Holder containing the value associated wth the key or an empty Holder if no value is associated with the key.
      Parameters:
      key - identifies the value to retrieve
      Returns:
      possibly empty Holder containing any value associated with the key