org.javimmutable.collections
Interface Mapped<K,V>

Type Parameters:
K -
V -
All Known Subinterfaces:
JImmutableListMap<K,V>, JImmutableMap<K,V>
All Known Implementing Classes:
AbstractJImmutableListMap, AbstractJImmutableMap, EmptyHashMap, JImmutableHashListMap, JImmutableHashMap, JImmutableInsertOrderListMap, JImmutableInsertOrderMap, JImmutableTreeListMap, JImmutableTreeMap

public interface Mapped<K,V>

Interface for containers that associate keys with values.


Method Summary
 Holder<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.
 V get(K key)
          Return the value associated with key or null if no value is associated.
 V getValueOr(K key, V defaultValue)
          Return the value associated with key or defaultValue if no value is associated.
 

Method Detail

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
Holder<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


Copyright © 2014 Burton Computer Corporation. All rights reserved.