Package org.apache.cayenne.util
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 SummaryConstructorsConstructorDescriptionSingleEntryMap(K key) Create empty mapSingleEntryMap(K key, V value) Create map with single key-value entry
- 
Method SummaryModifier 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 class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.MapreplaceAll
- 
Constructor Details- 
SingleEntryMapCreate empty map- Parameters:
- key- that can be stored in this map, can't be null
 
- 
SingleEntryMapCreate map with single key-value entry- Parameters:
- key- that can be stored in this map, can't be null
- value- to store, if null map will be empty.
 
 
- 
- 
Method Details- 
entrySet
- 
containsKey- Specified by:
- containsKeyin interface- Map<K,- V> 
 
- 
sizepublic int size()
- 
isEmptypublic boolean isEmpty()
- 
containsValue- Specified by:
- containsValuein interface- Map<K,- V> 
 
- 
get
- 
put
- 
remove
- 
putAll
- 
clearpublic void clear()
- 
keySet
- 
values
- 
getKey
- 
getValue
- 
setValue
- 
equals
- 
hashCodepublic int hashCode()
- 
toString
- 
forEach
- 
getOrDefault- Specified by:
- getOrDefaultin interface- Map<K,- V> 
 
- 
putIfAbsent- Specified by:
- putIfAbsentin interface- Map<K,- V> 
 
- 
computeIfAbsent- Specified by:
- computeIfAbsentin interface- Map<K,- V> 
 
- 
computeIfPresent- Specified by:
- computeIfPresentin interface- Map<K,- V> 
 
- 
compute
- 
merge
- 
replace
- 
replace
- 
remove
 
-