Package com.cedarsoftware.util
Class ConcurrentNavigableMapNullSafe<K,V>
java.lang.Object
com.cedarsoftware.util.AbstractConcurrentNullSafeMap<K,V>
com.cedarsoftware.util.ConcurrentNavigableMapNullSafe<K,V>
- Type Parameters:
K
- The type of keys maintained by this mapV
- The type of mapped values
- All Implemented Interfaces:
ConcurrentMap<K,
,V> ConcurrentNavigableMap<K,
,V> Map<K,
,V> NavigableMap<K,
,V> SortedMap<K,
V>
public class ConcurrentNavigableMapNullSafe<K,V>
extends AbstractConcurrentNullSafeMap<K,V>
implements ConcurrentNavigableMap<K,V>
ConcurrentNavigableMapNullSafe is a thread-safe implementation of ConcurrentNavigableMap
that allows null keys and null values by using a unique String sentinel for null keys.
From an ordering perspective, null keys are considered last. This is honored with the
ascending and descending views, where ascending view places them last, and descending view
place a null key first.
- Author:
- John DeRegnaucourt ([email protected])
Copyright (c) Cedar Software LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
License
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.cedarsoftware.util.AbstractConcurrentNullSafeMap
AbstractConcurrentNullSafeMap.NullSentinel
-
Field Summary
Fields inherited from class com.cedarsoftware.util.AbstractConcurrentNullSafeMap
internalMap
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new, empty ConcurrentNavigableMapNullSafe with natural ordering of its keys.ConcurrentNavigableMapNullSafe
(Comparator<? super K> comparator) Constructs a new, empty ConcurrentNavigableMapNullSafe with the specified comparator. -
Method Summary
Modifier and TypeMethodDescriptionceilingEntry
(K key) ceilingKey
(K key) Comparator
<? super K> firstKey()
floorEntry
(K key) higherEntry
(K key) keySet()
lastKey()
lowerEntry
(K key) protected Object
maskNullKey
(K key) protected K
unmaskNullKey
(Object maskedKey) Methods inherited from class com.cedarsoftware.util.AbstractConcurrentNullSafeMap
clear, compute, computeIfAbsent, containsKey, containsValue, entrySet, equals, get, getOrDefault, hashCode, isEmpty, maskNullValue, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size, toString, unmaskNullValue, values
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.concurrent.ConcurrentMap
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
ConcurrentNavigableMapNullSafe
public ConcurrentNavigableMapNullSafe()Constructs a new, empty ConcurrentNavigableMapNullSafe with natural ordering of its keys. All keys inserted must implement the Comparable interface. -
ConcurrentNavigableMapNullSafe
Constructs a new, empty ConcurrentNavigableMapNullSafe with the specified comparator.- Parameters:
comparator
- the comparator that will be used to order this map. If null, the natural ordering of the keys will be used.
-
-
Method Details
-
maskNullKey
- Overrides:
maskNullKey
in classAbstractConcurrentNullSafeMap<K,
V>
-
unmaskNullKey
- Overrides:
unmaskNullKey
in classAbstractConcurrentNullSafeMap<K,
V>
-
comparator
- Specified by:
comparator
in interfaceSortedMap<K,
V>
-
subMap
public ConcurrentNavigableMap<K,V> subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive) - Specified by:
subMap
in interfaceConcurrentNavigableMap<K,
V> - Specified by:
subMap
in interfaceNavigableMap<K,
V>
-
headMap
- Specified by:
headMap
in interfaceConcurrentNavigableMap<K,
V> - Specified by:
headMap
in interfaceNavigableMap<K,
V>
-
tailMap
- Specified by:
tailMap
in interfaceConcurrentNavigableMap<K,
V> - Specified by:
tailMap
in interfaceNavigableMap<K,
V>
-
subMap
-
headMap
-
tailMap
-
lowerEntry
- Specified by:
lowerEntry
in interfaceNavigableMap<K,
V>
-
lowerKey
- Specified by:
lowerKey
in interfaceNavigableMap<K,
V>
-
floorEntry
- Specified by:
floorEntry
in interfaceNavigableMap<K,
V>
-
floorKey
- Specified by:
floorKey
in interfaceNavigableMap<K,
V>
-
ceilingEntry
- Specified by:
ceilingEntry
in interfaceNavigableMap<K,
V>
-
ceilingKey
- Specified by:
ceilingKey
in interfaceNavigableMap<K,
V>
-
higherEntry
- Specified by:
higherEntry
in interfaceNavigableMap<K,
V>
-
higherKey
- Specified by:
higherKey
in interfaceNavigableMap<K,
V>
-
firstEntry
- Specified by:
firstEntry
in interfaceNavigableMap<K,
V>
-
lastEntry
- Specified by:
lastEntry
in interfaceNavigableMap<K,
V>
-
pollFirstEntry
- Specified by:
pollFirstEntry
in interfaceNavigableMap<K,
V>
-
pollLastEntry
- Specified by:
pollLastEntry
in interfaceNavigableMap<K,
V>
-
firstKey
-
lastKey
-
descendingKeySet
- Specified by:
descendingKeySet
in interfaceConcurrentNavigableMap<K,
V> - Specified by:
descendingKeySet
in interfaceNavigableMap<K,
V>
-
descendingMap
- Specified by:
descendingMap
in interfaceConcurrentNavigableMap<K,
V> - Specified by:
descendingMap
in interfaceNavigableMap<K,
V>
-
keySet
-