Package com.tangosol.util
Class SafeSortedMap
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.concurrent.ConcurrentSkipListMap
-
- com.tangosol.util.SafeSortedMap
-
- All Implemented Interfaces:
Serializable
,Cloneable
,ConcurrentMap
,ConcurrentNavigableMap
,Map
,NavigableMap
,SortedMap
public class SafeSortedMap extends ConcurrentSkipListMap
Implementation of aSortedMap
extendingConcurrentSkipListMap
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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
SafeSortedMap.EntrySet
Entry set delegation of the super map implementation.protected static class
SafeSortedMap.KeySet
Key set delegation of the super map implementation.static class
SafeSortedMap.Null
protected static class
SafeSortedMap.NullableEntry
Map.Entry implementation that supports null key/value placeholders.protected static class
SafeSortedMap.SubMap
SubMap delegation to manageNULL
in entry key and/or value.protected static class
SafeSortedMap.Values
Values delegation of the super map implementation.-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Constructor Summary
Constructors Constructor Description SafeSortedMap()
Construct 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
-
Methods inherited from class java.util.concurrent.ConcurrentSkipListMap
ceilingEntry, ceilingKey, clear, comparator, firstEntry, floorEntry, floorKey, higherEntry, higherKey, isEmpty, lastEntry, lowerEntry, lowerKey, navigableKeySet, pollFirstEntry, pollLastEntry, size
-
Methods inherited from class java.util.AbstractMap
hashCode, putAll, toString
-
-
-
-
Constructor Detail
-
SafeSortedMap
public SafeSortedMap()
Construct a new SafeSortedMap using the natural ordering of the Comparable keys in this map.
-
SafeSortedMap
public SafeSortedMap(SortedMap that)
Construct a new SafeSortedMap copying the contents of the specified map.- Parameters:
that
- the map copied
-
SafeSortedMap
public SafeSortedMap(Comparator comparator)
Construct a new SafeSortedMap with the specified Comparator.- Parameters:
comparator
- the comparator used to sort this map
-
-
Method Detail
-
get
public Object get(Object oKey)
- Specified by:
get
in interfaceMap
- Overrides:
get
in classConcurrentSkipListMap
-
put
public Object put(Object oKey, Object oValue)
- Specified by:
put
in interfaceMap
- Overrides:
put
in classConcurrentSkipListMap
-
remove
public Object remove(Object oKey)
- Specified by:
remove
in interfaceMap
- Overrides:
remove
in classConcurrentSkipListMap
-
equals
public boolean equals(Object oMap)
- Specified by:
equals
in interfaceMap
- Overrides:
equals
in classConcurrentSkipListMap
-
clone
public SafeSortedMap clone()
- Overrides:
clone
in classConcurrentSkipListMap
-
containsKey
public boolean containsKey(Object oKey)
- Specified by:
containsKey
in interfaceMap
- Overrides:
containsKey
in classConcurrentSkipListMap
-
containsValue
public boolean containsValue(Object oValue)
- Specified by:
containsValue
in interfaceMap
- Overrides:
containsValue
in classConcurrentSkipListMap
-
keySet
public NavigableSet keySet()
- Specified by:
keySet
in interfaceConcurrentNavigableMap
- Specified by:
keySet
in interfaceMap
- Specified by:
keySet
in interfaceSortedMap
- Overrides:
keySet
in classConcurrentSkipListMap
-
values
public Collection values()
-
descendingMap
public ConcurrentNavigableMap descendingMap()
- Specified by:
descendingMap
in interfaceConcurrentNavigableMap
- Specified by:
descendingMap
in interfaceNavigableMap
- Overrides:
descendingMap
in classConcurrentSkipListMap
-
descendingKeySet
public NavigableSet descendingKeySet()
- Specified by:
descendingKeySet
in interfaceConcurrentNavigableMap
- Specified by:
descendingKeySet
in interfaceNavigableMap
- Overrides:
descendingKeySet
in classConcurrentSkipListMap
-
getEntry
public Map.Entry getEntry(Object oKey)
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
public Object firstKey()
- Specified by:
firstKey
in interfaceSortedMap
- Overrides:
firstKey
in classConcurrentSkipListMap
-
lastKey
public Object 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
public ConcurrentNavigableMap headMap(Object oToKey, boolean fInclusive)
- Specified by:
headMap
in interfaceConcurrentNavigableMap
- Specified by:
headMap
in interfaceNavigableMap
- Overrides:
headMap
in classConcurrentSkipListMap
-
tailMap
public ConcurrentNavigableMap tailMap(Object oFromKey, boolean fInclusive)
- Specified by:
tailMap
in interfaceConcurrentNavigableMap
- Specified by:
tailMap
in interfaceNavigableMap
- Overrides:
tailMap
in classConcurrentSkipListMap
-
subMap
public ConcurrentNavigableMap subMap(Object oFromKey, Object oToKey)
- Specified by:
subMap
in interfaceConcurrentNavigableMap
- Specified by:
subMap
in interfaceNavigableMap
- Specified by:
subMap
in interfaceSortedMap
- Overrides:
subMap
in classConcurrentSkipListMap
-
headMap
public ConcurrentNavigableMap headMap(Object oToKey)
- Specified by:
headMap
in interfaceConcurrentNavigableMap
- Specified by:
headMap
in interfaceNavigableMap
- Specified by:
headMap
in interfaceSortedMap
- Overrides:
headMap
in classConcurrentSkipListMap
-
tailMap
public ConcurrentNavigableMap tailMap(Object fromKey)
- Specified by:
tailMap
in interfaceConcurrentNavigableMap
- Specified by:
tailMap
in interfaceNavigableMap
- Specified by:
tailMap
in interfaceSortedMap
- Overrides:
tailMap
in classConcurrentSkipListMap
-
putIfAbsent
public Object putIfAbsent(Object oKey, Object oValue)
- Specified by:
putIfAbsent
in interfaceConcurrentMap
- Specified by:
putIfAbsent
in interfaceMap
- Overrides:
putIfAbsent
in classConcurrentSkipListMap
-
getOrDefault
public Object getOrDefault(Object oKey, Object oDefaultValue)
- Specified by:
getOrDefault
in interfaceConcurrentMap
- Specified by:
getOrDefault
in interfaceMap
- Overrides:
getOrDefault
in classConcurrentSkipListMap
-
forEach
public void forEach(BiConsumer action)
- Specified by:
forEach
in interfaceConcurrentMap
- Specified by:
forEach
in interfaceMap
- Overrides:
forEach
in classConcurrentSkipListMap
-
remove
public boolean remove(Object oKey, Object oValue)
- Specified by:
remove
in interfaceConcurrentMap
- Specified by:
remove
in interfaceMap
- Overrides:
remove
in classConcurrentSkipListMap
-
replace
public boolean replace(Object oKey, Object oOldValue, Object oNewValue)
- Specified by:
replace
in interfaceConcurrentMap
- Specified by:
replace
in interfaceMap
- Overrides:
replace
in classConcurrentSkipListMap
-
replace
public Object replace(Object oKey, Object oValue)
- Specified by:
replace
in interfaceConcurrentMap
- Specified by:
replace
in interfaceMap
- Overrides:
replace
in classConcurrentSkipListMap
-
replaceAll
public void replaceAll(BiFunction function)
- Specified by:
replaceAll
in interfaceConcurrentMap
- Specified by:
replaceAll
in interfaceMap
- Overrides:
replaceAll
in classConcurrentSkipListMap
-
computeIfAbsent
public Object computeIfAbsent(Object oKey, Function mappingFunction)
- Specified by:
computeIfAbsent
in interfaceConcurrentMap
- Specified by:
computeIfAbsent
in interfaceMap
- Overrides:
computeIfAbsent
in classConcurrentSkipListMap
-
computeIfPresent
public Object computeIfPresent(Object oKey, BiFunction remappingFunction)
- Specified by:
computeIfPresent
in interfaceConcurrentMap
- Specified by:
computeIfPresent
in interfaceMap
- Overrides:
computeIfPresent
in classConcurrentSkipListMap
-
compute
public Object compute(Object oKey, BiFunction remappingFunction)
- Specified by:
compute
in interfaceConcurrentMap
- Specified by:
compute
in interfaceMap
- Overrides:
compute
in classConcurrentSkipListMap
-
merge
public Object merge(Object oKey, Object oValue, BiFunction remappingFunction)
- Specified by:
merge
in interfaceConcurrentMap
- Specified by:
merge
in interfaceMap
- Overrides:
merge
in classConcurrentSkipListMap
-
-