public class SafeSortedMap extends ConcurrentSkipListMap
SortedMap
extending ConcurrentSkipListMap
to support null keys and null values. Note that unlike its super class, this class is not serializable.Modifier and Type | Class and 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 manage
NULL in entry key and/or value. |
protected static class |
SafeSortedMap.Values
Values delegation of the super map implementation.
|
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Modifier and Type | Field and Description |
---|---|
static SortedMap<?,?> |
EMPTY
An empty, immutable SafeSortedMap instance.
|
static Object |
NULL
Placeholder for a
null key or value. |
Constructor and 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.
|
ceilingEntry, ceilingKey, clear, comparator, firstEntry, floorEntry, floorKey, higherEntry, higherKey, isEmpty, lastEntry, lowerEntry, lowerKey, navigableKeySet, pollFirstEntry, pollLastEntry, size
hashCode, putAll, toString
public static final SortedMap<?,?> EMPTY
public static final Object NULL
null
key or value.public SafeSortedMap()
public SafeSortedMap(SortedMap that)
that
- the map copiedpublic SafeSortedMap(Comparator comparator)
comparator
- the comparator used to sort this mappublic Object get(Object oKey)
get
in interface Map
get
in class ConcurrentSkipListMap
public Object put(Object oKey, Object oValue)
put
in interface Map
put
in class ConcurrentSkipListMap
public Object remove(Object oKey)
remove
in interface Map
remove
in class ConcurrentSkipListMap
public boolean equals(Object oMap)
equals
in interface Map
equals
in class ConcurrentSkipListMap
public SafeSortedMap clone()
clone
in class ConcurrentSkipListMap
public boolean containsKey(Object oKey)
containsKey
in interface Map
containsKey
in class ConcurrentSkipListMap
public boolean containsValue(Object oValue)
containsValue
in interface Map
containsValue
in class ConcurrentSkipListMap
public NavigableSet keySet()
keySet
in interface ConcurrentNavigableMap
keySet
in interface Map
keySet
in interface SortedMap
keySet
in class ConcurrentSkipListMap
public Collection values()
public ConcurrentNavigableMap descendingMap()
descendingMap
in interface ConcurrentNavigableMap
descendingMap
in interface NavigableMap
descendingMap
in class ConcurrentSkipListMap
public NavigableSet descendingKeySet()
descendingKeySet
in interface ConcurrentNavigableMap
descendingKeySet
in interface NavigableMap
descendingKeySet
in class ConcurrentSkipListMap
public Map.Entry getEntry(Object oKey)
Note: the behaviour of {#setValue} on the returned Entry is undefined in the presence of concurrent modifications
oKey
- the key to return an Entry forpublic Object firstKey()
firstKey
in interface SortedMap
firstKey
in class ConcurrentSkipListMap
public Object lastKey()
lastKey
in interface SortedMap
lastKey
in class ConcurrentSkipListMap
public ConcurrentNavigableMap subMap(Object oFromKey, boolean fFromInclusive, Object oToKey, boolean fToInclusive)
subMap
in interface ConcurrentNavigableMap
subMap
in interface NavigableMap
subMap
in class ConcurrentSkipListMap
public ConcurrentNavigableMap headMap(Object oToKey, boolean fInclusive)
headMap
in interface ConcurrentNavigableMap
headMap
in interface NavigableMap
headMap
in class ConcurrentSkipListMap
public ConcurrentNavigableMap tailMap(Object oFromKey, boolean fInclusive)
tailMap
in interface ConcurrentNavigableMap
tailMap
in interface NavigableMap
tailMap
in class ConcurrentSkipListMap
public ConcurrentNavigableMap subMap(Object oFromKey, Object oToKey)
subMap
in interface ConcurrentNavigableMap
subMap
in interface NavigableMap
subMap
in interface SortedMap
subMap
in class ConcurrentSkipListMap
public ConcurrentNavigableMap headMap(Object oToKey)
headMap
in interface ConcurrentNavigableMap
headMap
in interface NavigableMap
headMap
in interface SortedMap
headMap
in class ConcurrentSkipListMap
public ConcurrentNavigableMap tailMap(Object fromKey)
tailMap
in interface ConcurrentNavigableMap
tailMap
in interface NavigableMap
tailMap
in interface SortedMap
tailMap
in class ConcurrentSkipListMap
public Object putIfAbsent(Object oKey, Object oValue)
putIfAbsent
in interface ConcurrentMap
putIfAbsent
in interface Map
putIfAbsent
in class ConcurrentSkipListMap
public Object getOrDefault(Object oKey, Object oDefaultValue)
getOrDefault
in interface ConcurrentMap
getOrDefault
in interface Map
getOrDefault
in class ConcurrentSkipListMap
public void forEach(BiConsumer action)
forEach
in interface ConcurrentMap
forEach
in interface Map
forEach
in class ConcurrentSkipListMap
public boolean remove(Object oKey, Object oValue)
remove
in interface ConcurrentMap
remove
in interface Map
remove
in class ConcurrentSkipListMap
public boolean replace(Object oKey, Object oOldValue, Object oNewValue)
replace
in interface ConcurrentMap
replace
in interface Map
replace
in class ConcurrentSkipListMap
public Object replace(Object oKey, Object oValue)
replace
in interface ConcurrentMap
replace
in interface Map
replace
in class ConcurrentSkipListMap
public void replaceAll(BiFunction function)
replaceAll
in interface ConcurrentMap
replaceAll
in interface Map
replaceAll
in class ConcurrentSkipListMap
public Object computeIfAbsent(Object oKey, Function mappingFunction)
computeIfAbsent
in interface ConcurrentMap
computeIfAbsent
in interface Map
computeIfAbsent
in class ConcurrentSkipListMap
public Object computeIfPresent(Object oKey, BiFunction remappingFunction)
computeIfPresent
in interface ConcurrentMap
computeIfPresent
in interface Map
computeIfPresent
in class ConcurrentSkipListMap
public Object compute(Object oKey, BiFunction remappingFunction)
compute
in interface ConcurrentMap
compute
in interface Map
compute
in class ConcurrentSkipListMap
public Object merge(Object oKey, Object oValue, BiFunction remappingFunction)
merge
in interface ConcurrentMap
merge
in interface Map
merge
in class ConcurrentSkipListMap