Package com.tangosol.util
Class SafeSortedMap
java.lang.Object
java.util.AbstractMap
java.util.concurrent.ConcurrentSkipListMap
com.tangosol.util.SafeSortedMap
- All Implemented Interfaces:
Serializable
,Cloneable
,ConcurrentMap
,ConcurrentNavigableMap
,Map
,NavigableMap
,SequencedMap
,SortedMap
Implementation of a
SortedMap
extending ConcurrentSkipListMap
to support null keys and null values. Note that unlike its super class, this class is not serializable.- Since:
- 23.03
- Author:
- mg
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
Entry set delegation of the super map implementation.protected static class
Key set delegation of the super map implementation.static class
protected static class
Map.Entry implementation that supports null key/value placeholders.protected static class
SubMap delegation to manageNULL
in entry key and/or value.protected static class
Values delegation of the super map implementation.Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,
V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
-
Constructor Summary
ConstructorDescriptionConstruct a new SafeSortedMap using the natural ordering of the Comparable keys in this map.SafeSortedMap
(Comparator comparator) Construct a new SafeSortedMap with the specified Comparator.SafeSortedMap
(SortedMap that) Construct a new SafeSortedMap copying the contents of the specified map. -
Method Summary
Modifier and TypeMethodDescriptionclone()
compute
(Object oKey, BiFunction remappingFunction) computeIfAbsent
(Object oKey, Function mappingFunction) computeIfPresent
(Object oKey, BiFunction remappingFunction) boolean
containsKey
(Object oKey) boolean
containsValue
(Object oValue) entrySet()
boolean
firstKey()
void
forEach
(BiConsumer action) Locate a Map.Entry in this map based on its key.getOrDefault
(Object oKey, Object oDefaultValue) keySet()
lastKey()
merge
(Object oKey, Object oValue, BiFunction remappingFunction) putIfAbsent
(Object oKey, Object oValue) boolean
boolean
void
replaceAll
(BiFunction function) values()
Methods inherited from class java.util.concurrent.ConcurrentSkipListMap
ceilingEntry, ceilingKey, clear, comparator, firstEntry, floorEntry, floorKey, higherEntry, higherKey, isEmpty, lastEntry, lowerEntry, lowerKey, navigableKeySet, pollFirstEntry, pollLastEntry, putFirst, putLast, size
Methods inherited from class java.util.AbstractMap
hashCode, putAll, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.NavigableMap
reversed
Methods inherited from interface java.util.SequencedMap
sequencedEntrySet, sequencedKeySet, sequencedValues
-
Field Details
-
EMPTY
An empty, immutable SafeSortedMap instance. -
NULL
Placeholder for anull
key or value.
-
-
Constructor Details
-
SafeSortedMap
public SafeSortedMap()Construct a new SafeSortedMap using the natural ordering of the Comparable keys in this map. -
SafeSortedMap
Construct a new SafeSortedMap copying the contents of the specified map.- Parameters:
that
- the map copied
-
SafeSortedMap
Construct a new SafeSortedMap with the specified Comparator.- Parameters:
comparator
- the comparator used to sort this map
-
-
Method Details
-
get
- Specified by:
get
in interfaceMap
- Overrides:
get
in classConcurrentSkipListMap
-
put
- Specified by:
put
in interfaceMap
- Overrides:
put
in classConcurrentSkipListMap
-
remove
- Specified by:
remove
in interfaceMap
- Overrides:
remove
in classConcurrentSkipListMap
-
equals
- Specified by:
equals
in interfaceMap
- Overrides:
equals
in classConcurrentSkipListMap
-
clone
- Overrides:
clone
in classConcurrentSkipListMap
-
containsKey
- Specified by:
containsKey
in interfaceMap
- Overrides:
containsKey
in classConcurrentSkipListMap
-
containsValue
- Specified by:
containsValue
in interfaceMap
- Overrides:
containsValue
in classConcurrentSkipListMap
-
entrySet
-
keySet
- Specified by:
keySet
in interfaceConcurrentNavigableMap
- Specified by:
keySet
in interfaceMap
- Specified by:
keySet
in interfaceSortedMap
- Overrides:
keySet
in classConcurrentSkipListMap
-
values
-
descendingMap
- Specified by:
descendingMap
in interfaceConcurrentNavigableMap
- Specified by:
descendingMap
in interfaceNavigableMap
- Overrides:
descendingMap
in classConcurrentSkipListMap
-
descendingKeySet
- Specified by:
descendingKeySet
in interfaceConcurrentNavigableMap
- Specified by:
descendingKeySet
in interfaceNavigableMap
- Overrides:
descendingKeySet
in classConcurrentSkipListMap
-
getEntry
Locate a Map.Entry in this map based on its key.Note: the behaviour of {#setValue} on the returned Entry is undefined in the presence of concurrent modifications
- Parameters:
oKey
- the key to return an Entry for- Returns:
- an Entry corresponding to the specified key, or null if none exists
-
firstKey
- Specified by:
firstKey
in interfaceSortedMap
- Overrides:
firstKey
in classConcurrentSkipListMap
-
lastKey
- Specified by:
lastKey
in interfaceSortedMap
- Overrides:
lastKey
in classConcurrentSkipListMap
-
subMap
public ConcurrentNavigableMap subMap(Object oFromKey, boolean fFromInclusive, Object oToKey, boolean fToInclusive) - Specified by:
subMap
in interfaceConcurrentNavigableMap
- Specified by:
subMap
in interfaceNavigableMap
- Overrides:
subMap
in classConcurrentSkipListMap
-
headMap
- Specified by:
headMap
in interfaceConcurrentNavigableMap
- Specified by:
headMap
in interfaceNavigableMap
- Overrides:
headMap
in classConcurrentSkipListMap
-
tailMap
- Specified by:
tailMap
in interfaceConcurrentNavigableMap
- Specified by:
tailMap
in interfaceNavigableMap
- Overrides:
tailMap
in classConcurrentSkipListMap
-
subMap
- Specified by:
subMap
in interfaceConcurrentNavigableMap
- Specified by:
subMap
in interfaceNavigableMap
- Specified by:
subMap
in interfaceSortedMap
- Overrides:
subMap
in classConcurrentSkipListMap
-
headMap
- Specified by:
headMap
in interfaceConcurrentNavigableMap
- Specified by:
headMap
in interfaceNavigableMap
- Specified by:
headMap
in interfaceSortedMap
- Overrides:
headMap
in classConcurrentSkipListMap
-
tailMap
- Specified by:
tailMap
in interfaceConcurrentNavigableMap
- Specified by:
tailMap
in interfaceNavigableMap
- Specified by:
tailMap
in interfaceSortedMap
- Overrides:
tailMap
in classConcurrentSkipListMap
-
putIfAbsent
- Specified by:
putIfAbsent
in interfaceConcurrentMap
- Specified by:
putIfAbsent
in interfaceMap
- Overrides:
putIfAbsent
in classConcurrentSkipListMap
-
getOrDefault
- Specified by:
getOrDefault
in interfaceConcurrentMap
- Specified by:
getOrDefault
in interfaceMap
- Overrides:
getOrDefault
in classConcurrentSkipListMap
-
forEach
- Specified by:
forEach
in interfaceConcurrentMap
- Specified by:
forEach
in interfaceMap
- Overrides:
forEach
in classConcurrentSkipListMap
-
remove
- Specified by:
remove
in interfaceConcurrentMap
- Specified by:
remove
in interfaceMap
- Overrides:
remove
in classConcurrentSkipListMap
-
replace
- Specified by:
replace
in interfaceConcurrentMap
- Specified by:
replace
in interfaceMap
- Overrides:
replace
in classConcurrentSkipListMap
-
replace
- Specified by:
replace
in interfaceConcurrentMap
- Specified by:
replace
in interfaceMap
- Overrides:
replace
in classConcurrentSkipListMap
-
replaceAll
- Specified by:
replaceAll
in interfaceConcurrentMap
- Specified by:
replaceAll
in interfaceMap
- Overrides:
replaceAll
in classConcurrentSkipListMap
-
computeIfAbsent
- Specified by:
computeIfAbsent
in interfaceConcurrentMap
- Specified by:
computeIfAbsent
in interfaceMap
- Overrides:
computeIfAbsent
in classConcurrentSkipListMap
-
computeIfPresent
- Specified by:
computeIfPresent
in interfaceConcurrentMap
- Specified by:
computeIfPresent
in interfaceMap
- Overrides:
computeIfPresent
in classConcurrentSkipListMap
-
compute
- Specified by:
compute
in interfaceConcurrentMap
- Specified by:
compute
in interfaceMap
- Overrides:
compute
in classConcurrentSkipListMap
-
merge
- Specified by:
merge
in interfaceConcurrentMap
- Specified by:
merge
in interfaceMap
- Overrides:
merge
in classConcurrentSkipListMap
-