Package com.tangosol.util
Class SetMap<K,V> 
java.lang.Object
java.util.AbstractMap<K,V>
 
com.tangosol.util.SetMap<K,V> 
- All Implemented Interfaces:
 Map<K,V> 
A Map implementation based on a known 
set of keys and a Function that when given a key can derive the value. Once a value has been
 derived for a key the function will not be called again for the same key.
 This map can be mutated outside of the original set of keys or within the set of keys. The latter will result in the function not being called for the respective keys.
 This implementation is the inverse to a MapSet which can trivially
 distill a Map of keys and values to a Set of keys. With the use of a Function
 this implementation allows a Set of keys to be converted lazily to a Map of
 keys and values.
- Since:
 - 12.2.1.4.0
 - Author:
 - hr 2016.09.29
 
- 
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V>  - 
Field Summary
Fields - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleancontainsKey(Object key) protected VensureValue(Object oKey) Return a value for the specified key.entrySet()Return an external map allowing type safe access.Return the internal map allowing any object to be stored.booleanisEmpty()keySet()voidintsize()Methods inherited from class java.util.AbstractMap
clone, containsValue, equals, hashCode, toString, valuesMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll 
- 
Field Details
- 
f_map
The underlying map. - 
f_functionValue
A function to load a value for a provided key. 
 - 
 - 
Constructor Details
- 
SetMap
Construct a SetMap.- Parameters:
 setKeys- a set of keys to base this Map on
 - 
SetMap
Construct a SetMap.- Parameters:
 setKeys- a set of keys to base this Map onfunctionValue- aFunctionto derive the value for a given key
 - 
SetMap
Construct a SetMap.- Parameters:
 setKeys- a set of keys to base this Map onfunctionValue- aFunctionto derive the value for a given keysupplierMap- the Map to use to hold keys and values
 
 - 
 - 
Method Details
- 
size
public int size() - 
isEmpty
public boolean isEmpty() - 
containsKey
- Specified by:
 containsKeyin interfaceMap<K,V> - Overrides:
 containsKeyin classAbstractMap<K,V> 
 - 
get
 - 
put
 - 
remove
 - 
putAll
 - 
clear
public void clear() - 
keySet
 - 
entrySet
 - 
getInternalMap
Return the internal map allowing any object to be stored.- Returns:
 - the internal map
 
 - 
getExternalMap
Return an external map allowing type safe access.- Returns:
 - an external map
 
 - 
ensureValue
Return a value for the specified key.- Parameters:
 oKey- the key to load a value for- Returns:
 - a value for the specified key
 
 
 -