Package com.landawn.abacus.util
Class ImmutableNavigableMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
com.landawn.abacus.util.ImmutableMap<K,V>
com.landawn.abacus.util.ImmutableSortedMap<K,V>
com.landawn.abacus.util.ImmutableNavigableMap<K,V>
- Type Parameters:
K
- the key typeV
- the value type
- All Implemented Interfaces:
Immutable
,Map<K,
,V> NavigableMap<K,
,V> SequencedMap<K,
,V> SortedMap<K,
V>
public class ImmutableNavigableMap<K,V>
extends ImmutableSortedMap<K,V>
implements NavigableMap<K,V>
-
Nested Class Summary
Nested classes/interfaces inherited from class com.landawn.abacus.util.ImmutableMap
ImmutableMap.Builder<K,
V> Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,
V>, AbstractMap.SimpleImmutableEntry<K, V> -
Method Summary
Modifier and TypeMethodDescriptionceilingEntry
(K key) ceilingKey
(K key) static <K,
V> ImmutableNavigableMap <K, V> Returns an ImmutableNavigableMap containing the same mappings as the provided SortedMap.Descending key set.static <K,
V> ImmutableNavigableMap <K, V> empty()
Returns an empty ImmutableNavigableMap.floorEntry
(K key) higherEntry
(K key) lowerEntry
(K key) Navigable key set.static <K extends Comparable<? super K>,
V>
ImmutableNavigableMap<K, V> of
(K k1, V v1) Returns an ImmutableNavigableMap containing the provided key-value pair.static <K extends Comparable<? super K>,
V>
ImmutableNavigableMap<K, V> of
(K k1, V v1, K k2, V v2) Returns an ImmutableNavigableMap containing the provided key-value pairs.static <K extends Comparable<? super K>,
V>
ImmutableNavigableMap<K, V> of
(K k1, V v1, K k2, V v2, K k3, V v3) Returns an ImmutableNavigableMap containing the provided key-value pairs.static <K extends Comparable<? super K>,
V>
ImmutableNavigableMap<K, V> of
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) Returns an ImmutableNavigableMap containing the provided key-value pairs.static <K extends Comparable<? super K>,
V>
ImmutableNavigableMap<K, V> of
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) Returns an ImmutableNavigableMap containing the provided key-value pairs.static <K extends Comparable<? super K>,
V>
ImmutableNavigableMap<K, V> of
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) Returns an ImmutableNavigableMap containing the provided key-value pairs.static <K extends Comparable<? super K>,
V>
ImmutableNavigableMap<K, V> of
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) Returns an ImmutableNavigableMap containing the provided key-value pairs.static <K extends Comparable<? super K>,
V>
ImmutableNavigableMap<K, V> of
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8) Returns an ImmutableNavigableMap containing the provided key-value pairs.static <K extends Comparable<? super K>,
V>
ImmutableNavigableMap<K, V> of
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9) Returns an ImmutableNavigableMap containing the provided key-value pairs.static <K extends Comparable<? super K>,
V>
ImmutableNavigableMap<K, V> of
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9, K k10, V v10) Returns an ImmutableNavigableMap containing the provided key-value pairs.Deprecated.Deprecated.throwsUnsupportedOperationException
static <K,
V> ImmutableNavigableMap <K, V> wrap
(NavigableMap<? extends K, ? extends V> navigableMap) Returns an ImmutableNavigableMap that is backed by the provided NavigableMap.static <K,
V> ImmutableSortedMap <K, V> Deprecated.throwsUnsupportedOperationException
Methods inherited from class com.landawn.abacus.util.ImmutableSortedMap
comparator, copyOf, firstKey, headMap, lastKey, subMap, tailMap, wrap
Methods inherited from class com.landawn.abacus.util.ImmutableMap
builder, builder, clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, get, getOrDefault, isEmpty, keySet, merge, of, of, of, of, of, of, of, of, of, of, put, putAll, putIfAbsent, remove, remove, replace, replace, size, values
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, get, getOrDefault, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size
Methods inherited from interface java.util.NavigableMap
headMap, reversed, subMap, tailMap
Methods inherited from interface java.util.SequencedMap
sequencedEntrySet, sequencedKeySet, sequencedValues
-
Method Details
-
empty
Returns an empty ImmutableNavigableMap.- Type Parameters:
K
- the type of the keys in the ImmutableNavigableMapV
- the type of the values in the ImmutableNavigableMap- Returns:
- an empty ImmutableNavigableMap
-
of
Returns an ImmutableNavigableMap containing the provided key-value pair.- Type Parameters:
K
- the type of the key in the ImmutableNavigableMapV
- the type of the value in the ImmutableNavigableMap- Parameters:
k1
- the key to be included in the ImmutableNavigableMapv1
- the value to be associated with the key- Returns:
- an ImmutableNavigableMap containing the provided key-value pair
-
of
public static <K extends Comparable<? super K>,V> ImmutableNavigableMap<K,V> of(K k1, V v1, K k2, V v2) Returns an ImmutableNavigableMap containing the provided key-value pairs.- Type Parameters:
K
- the type of the keys in the ImmutableNavigableMapV
- the type of the values in the ImmutableNavigableMap- Parameters:
k1
- the first key to be included in the ImmutableNavigableMapv1
- the value to be associated with the first keyk2
- the second key to be included in the ImmutableNavigableMapv2
- the value to be associated with the second key- Returns:
- an ImmutableNavigableMap containing the provided key-value pairs
-
of
public static <K extends Comparable<? super K>,V> ImmutableNavigableMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3) Returns an ImmutableNavigableMap containing the provided key-value pairs.- Type Parameters:
K
- the type of the keys in the ImmutableNavigableMapV
- the type of the values in the ImmutableNavigableMap- Parameters:
k1
- the first key to be included in the ImmutableNavigableMapv1
- the value to be associated with the first keyk2
- the second key to be included in the ImmutableNavigableMapv2
- the value to be associated with the second keyk3
- the third key to be included in the ImmutableNavigableMapv3
- the value to be associated with the third key- Returns:
- an ImmutableNavigableMap containing the provided key-value pairs
-
of
public static <K extends Comparable<? super K>,V> ImmutableNavigableMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) Returns an ImmutableNavigableMap containing the provided key-value pairs.- Type Parameters:
K
- the type of the keys in the ImmutableNavigableMapV
- the type of the values in the ImmutableNavigableMap- Parameters:
k1
- to k4 the keys to be included in the ImmutableNavigableMapv1
- to v4 the values to be associated with the keys- Returns:
- an ImmutableSortedMap containing the provided key-value pairs
-
of
public static <K extends Comparable<? super K>,V> ImmutableNavigableMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) Returns an ImmutableNavigableMap containing the provided key-value pairs.- Type Parameters:
K
- the type of the keys in the ImmutableNavigableMapV
- the type of the values in the ImmutableNavigableMap- Parameters:
k1
- to k5 the keys to be included in the ImmutableNavigableMapv1
- to v5 the values to be associated with the keys- Returns:
- an ImmutableSortedMap containing the provided key-value pairs
-
of
public static <K extends Comparable<? super K>,V> ImmutableNavigableMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) Returns an ImmutableNavigableMap containing the provided key-value pairs.- Type Parameters:
K
- the type of the keys in the ImmutableNavigableMapV
- the type of the values in the ImmutableNavigableMap- Parameters:
k1
- to k6 the keys to be included in the ImmutableNavigableMapv1
- to v6 the values to be associated with the keys- Returns:
- an ImmutableSortedMap containing the provided key-value pairs
-
of
public static <K extends Comparable<? super K>,V> ImmutableNavigableMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) Returns an ImmutableNavigableMap containing the provided key-value pairs.- Type Parameters:
K
- the type of the keys in the ImmutableNavigableMapV
- the type of the values in the ImmutableNavigableMap- Parameters:
k1
- to k7 the keys to be included in the ImmutableNavigableMapv1
- to v7 the values to be associated with the keys- Returns:
- an ImmutableSortedMap containing the provided key-value pairs
-
of
public static <K extends Comparable<? super K>,V> ImmutableNavigableMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8) Returns an ImmutableNavigableMap containing the provided key-value pairs.- Type Parameters:
K
- the type of the keys in the ImmutableNavigableMapV
- the type of the values in the ImmutableNavigableMap- Parameters:
k1
- to k8 the keys to be included in the ImmutableNavigableMapv1
- to v8 the values to be associated with the keys- Returns:
- an ImmutableSortedMap containing the provided key-value pairs
-
of
public static <K extends Comparable<? super K>,V> ImmutableNavigableMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9) Returns an ImmutableNavigableMap containing the provided key-value pairs.- Type Parameters:
K
- the type of the keys in the ImmutableNavigableMapV
- the type of the values in the ImmutableNavigableMap- Parameters:
k1
- to k9 the keys to be included in the ImmutableNavigableMapv1
- to v9 the values to be associated with the keys- Returns:
- an ImmutableSortedMap containing the provided key-value pairs
-
of
public static <K extends Comparable<? super K>,V> ImmutableNavigableMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9, K k10, V v10) Returns an ImmutableNavigableMap containing the provided key-value pairs.- Type Parameters:
K
- the type of the keys in the ImmutableNavigableMapV
- the type of the values in the ImmutableNavigableMap- Parameters:
k1
- to k10 the keys to be included in the ImmutableNavigableMapv1
- to v10 the values to be associated with the keys- Returns:
- an ImmutableSortedMap containing the provided key-value pairs
-
copyOf
public static <K,V> ImmutableNavigableMap<K,V> copyOf(SortedMap<? extends K, ? extends V> sortedMap) Returns an ImmutableNavigableMap containing the same mappings as the provided SortedMap. If the provided SortedMap is already an instance of ImmutableNavigableMap, it is directly returned. If the provided SortedMap isnull
or empty, an empty ImmutableNavigableMap is returned. Otherwise, a new ImmutableNavigableMap is created with the elements of the provided SortedMap.- Type Parameters:
K
- the type of keys in the SortedMapV
- the type of values in the SortedMap- Parameters:
sortedMap
- the SortedMap whose mappings are to be placed in the ImmutableNavigableMap- Returns:
- an ImmutableNavigableMap containing the same mappings as the provided SortedMap
-
wrap
@Deprecated public static <K,V> ImmutableSortedMap<K,V> wrap(SortedMap<? extends K, ? extends V> sortedMap) throws UnsupportedOperationExceptionDeprecated.throwsUnsupportedOperationException
This method is deprecated and will throw an UnsupportedOperationException if used.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
sortedMap
-- Returns:
- Throws:
UnsupportedOperationException
-
lowerEntry
- Specified by:
lowerEntry
in interfaceNavigableMap<K,
V> - Parameters:
key
-- Returns:
-
lowerKey
- Specified by:
lowerKey
in interfaceNavigableMap<K,
V> - Parameters:
key
-- Returns:
-
floorEntry
- Specified by:
floorEntry
in interfaceNavigableMap<K,
V> - Parameters:
key
-- Returns:
-
floorKey
- Specified by:
floorKey
in interfaceNavigableMap<K,
V> - Parameters:
key
-- Returns:
-
ceilingEntry
- Specified by:
ceilingEntry
in interfaceNavigableMap<K,
V> - Parameters:
key
-- Returns:
-
ceilingKey
- Specified by:
ceilingKey
in interfaceNavigableMap<K,
V> - Parameters:
key
-- Returns:
-
higherEntry
- Specified by:
higherEntry
in interfaceNavigableMap<K,
V> - Parameters:
key
-- Returns:
-
higherKey
- Specified by:
higherKey
in interfaceNavigableMap<K,
V> - Parameters:
key
-- Returns:
-
firstEntry
- Specified by:
firstEntry
in interfaceNavigableMap<K,
V> - Specified by:
firstEntry
in interfaceSequencedMap<K,
V>
-
lastEntry
- Specified by:
lastEntry
in interfaceNavigableMap<K,
V> - Specified by:
lastEntry
in interfaceSequencedMap<K,
V>
-
pollFirstEntry
Deprecated.throwsUnsupportedOperationException
Poll first entry.- Specified by:
pollFirstEntry
in interfaceNavigableMap<K,
V> - Specified by:
pollFirstEntry
in interfaceSequencedMap<K,
V> - Returns:
- Throws:
UnsupportedOperationException
-
pollLastEntry
Deprecated.throwsUnsupportedOperationException
Poll last entry.- Specified by:
pollLastEntry
in interfaceNavigableMap<K,
V> - Specified by:
pollLastEntry
in interfaceSequencedMap<K,
V> - Returns:
- Throws:
UnsupportedOperationException
-
descendingMap
- Specified by:
descendingMap
in interfaceNavigableMap<K,
V>
-
descendingKeySet
Descending key set.- Specified by:
descendingKeySet
in interfaceNavigableMap<K,
V> - Returns:
-
subMap
public ImmutableNavigableMap<K,V> subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive) - Specified by:
subMap
in interfaceNavigableMap<K,
V> - Parameters:
fromKey
-fromInclusive
-toKey
-toInclusive
-- Returns:
-
headMap
- Specified by:
headMap
in interfaceNavigableMap<K,
V> - Parameters:
toKey
-inclusive
-- Returns:
-
tailMap
- Specified by:
tailMap
in interfaceNavigableMap<K,
V> - Parameters:
fromKey
-inclusive
-- Returns:
-
UnsupportedOperationException