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 values. A dedicated sentinel object is used internally to
represent null keys, ensuring no accidental key collisions.
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 ObjectmaskNullKey(Object key) protected KunmaskNullKey(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, valuesMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:
maskNullKeyin classAbstractConcurrentNullSafeMap<K,V>
-
unmaskNullKey
- Overrides:
unmaskNullKeyin classAbstractConcurrentNullSafeMap<K,V>
-
comparator
- Specified by:
comparatorin interfaceSortedMap<K,V>
-
subMap
public ConcurrentNavigableMap<K,V> subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive) - Specified by:
subMapin interfaceConcurrentNavigableMap<K,V> - Specified by:
subMapin interfaceNavigableMap<K,V>
-
headMap
- Specified by:
headMapin interfaceConcurrentNavigableMap<K,V> - Specified by:
headMapin interfaceNavigableMap<K,V>
-
tailMap
- Specified by:
tailMapin interfaceConcurrentNavigableMap<K,V> - Specified by:
tailMapin interfaceNavigableMap<K,V>
-
subMap
-
headMap
-
tailMap
-
lowerEntry
- Specified by:
lowerEntryin interfaceNavigableMap<K,V>
-
lowerKey
- Specified by:
lowerKeyin interfaceNavigableMap<K,V>
-
floorEntry
- Specified by:
floorEntryin interfaceNavigableMap<K,V>
-
floorKey
- Specified by:
floorKeyin interfaceNavigableMap<K,V>
-
ceilingEntry
- Specified by:
ceilingEntryin interfaceNavigableMap<K,V>
-
ceilingKey
- Specified by:
ceilingKeyin interfaceNavigableMap<K,V>
-
higherEntry
- Specified by:
higherEntryin interfaceNavigableMap<K,V>
-
higherKey
- Specified by:
higherKeyin interfaceNavigableMap<K,V>
-
firstEntry
- Specified by:
firstEntryin interfaceNavigableMap<K,V>
-
lastEntry
- Specified by:
lastEntryin interfaceNavigableMap<K,V>
-
pollFirstEntry
- Specified by:
pollFirstEntryin interfaceNavigableMap<K,V>
-
pollLastEntry
- Specified by:
pollLastEntryin interfaceNavigableMap<K,V>
-
firstKey
-
lastKey
-
descendingKeySet
- Specified by:
descendingKeySetin interfaceConcurrentNavigableMap<K,V> - Specified by:
descendingKeySetin interfaceNavigableMap<K,V>
-
descendingMap
- Specified by:
descendingMapin interfaceConcurrentNavigableMap<K,V> - Specified by:
descendingMapin interfaceNavigableMap<K,V>
-
keySet
-