Class SingleEntryMap<K,V>
java.lang.Object
org.apache.cayenne.util.SingleEntryMap<K,V>
- All Implemented Interfaces:
Serializable, Map<K,V>, Map.Entry<K, V>
Optimized mutable single-entry map.
This implementation is compatible with general Map contract, including Map.equals(Object),
Map.hashCode() and AbstractMap.toString() implementations.
This Map can store only one key that is defined at creation time and can't be changed.
This map will throw IllegalArgumentException on any put operation with the wrong key
and return null on get.
This map will be effectively empty after putting null value.
- Since:
- 4.2
- See Also:
-
Nested Class Summary
-
Constructor Summary
ConstructorsConstructorDescriptionSingleEntryMap(K key) Create empty mapSingleEntryMap(K key, V value) Create map with single key-value entry -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()booleanvoidforEach(BiConsumer<? super K, ? super V> action) getKey()getOrDefault(Object key, V defaultValue) getValue()inthashCode()booleanisEmpty()keySet()voidputIfAbsent(K key, V value) booleanbooleanintsize()toString()values()Methods inherited from interface Map
replaceAll
-
Constructor Details
-
SingleEntryMap
Create empty map- Parameters:
key- that can be stored in this map, can't be null
-
SingleEntryMap
-
-
Method Details
-
entrySet
-
containsKey
- Specified by:
containsKeyin interfaceMap<K,V>
-
size
-
isEmpty
-
containsValue
- Specified by:
containsValuein interfaceMap<K,V>
-
get
-
put
-
remove
-
putAll
-
clear
-
keySet
-
values
-
getKey
-
getValue
-
setValue
-
equals
-
hashCode
-
toString
-
forEach
-
getOrDefault
-
putIfAbsent
-
computeIfAbsent
-
computeIfPresent
- Specified by:
computeIfPresentin interfaceMap<K,V>
-
compute
-
merge
-
replace
-
replace
-
remove
-