Package org.javimmutable.collections
Interface Mapped<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 TypeMethodDescriptionReturn a Holder containing the value associated wth the key or an empty Holder if no value is associated with the 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
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
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 retrievedefaultValue
- value to return if no entry exists for key- Returns:
- value associated with key or defaultValue if no value is associated
-
find
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
-