Class ImmutableSortedMap<K,V>
- All Implemented Interfaces:
Serializable
,Map<K,
,V> NavigableMap<K,
,V> SequencedMap<K,
,V> SortedMap<K,
V>
NavigableMap
whose contents will never change, with many other important properties
detailed at ImmutableCollection
.
Warning: as with any sorted collection, you are strongly advised not to use a Comparator
or Comparable
type whose comparison behavior is inconsistent with
equals. That is, a.compareTo(b)
or comparator.compare(a, b)
should equal zero
if and only if a.equals(b)
. If this advice is not followed, the resulting map will
not correctly obey its specification.
See the Guava User Guide article on immutable collections.
- Since:
- 2.0 (implements
NavigableMap
since 12.0) - See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A builder for creating immutable sorted map instances, especiallypublic static final
maps ("constant maps").private static class
Serialized type for all ImmutableSortedMap instances.Nested classes/interfaces inherited from class com.google.common.collect.ImmutableMap
ImmutableMap.IteratorBasedImmutableMap<K,
V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ImmutableSortedMap
<K, V> private final RegularImmutableSortedSet
<K> private static final ImmutableSortedMap
<Comparable<?>, Object> private static final Comparator
<?> private static final long
private final ImmutableList
<V> Fields inherited from class com.google.common.collect.ImmutableMap
EMPTY_ENTRY_ARRAY
-
Constructor Summary
ConstructorsConstructorDescriptionImmutableSortedMap
(RegularImmutableSortedSet<K> keySet, ImmutableList<V> valueList) ImmutableSortedMap
(RegularImmutableSortedSet<K> keySet, ImmutableList<V> valueList, ImmutableSortedMap<K, V> descendingMap) -
Method Summary
Modifier and TypeMethodDescriptionstatic <K,
V> ImmutableSortedMap.Builder <K, V> builder()
Deprecated.static <K,
V> ImmutableSortedMap.Builder <K, V> builderWithExpectedSize
(int expectedSize) Deprecated.Not supported for ImmutableSortedMap.ceilingEntry
(K key) ceilingKey
(K key) Comparator
<? super K> Returns the comparator that orders the keys, which isOrdering.natural()
when the natural ordering of the keys is used.static <K,
V> ImmutableSortedMap <K, V> Returns an immutable map containing the given entries, with keys sorted by their natural ordering.static <K,
V> ImmutableSortedMap <K, V> copyOf
(Iterable<? extends Map.Entry<? extends K, ? extends V>> entries, Comparator<? super K> comparator) Returns an immutable map containing the given entries, with keys sorted by the provided comparator.static <K,
V> ImmutableSortedMap <K, V> Returns an immutable map containing the same entries asmap
, sorted by the natural ordering of the keys.static <K,
V> ImmutableSortedMap <K, V> copyOf
(Map<? extends K, ? extends V> map, Comparator<? super K> comparator) Returns an immutable map containing the same entries asmap
, with keys sorted by the provided comparator.private static <K,
V> ImmutableSortedMap <K, V> copyOfInternal
(Map<? extends K, ? extends V> map, Comparator<? super K> comparator) static <K,
V> ImmutableSortedMap <K, V> copyOfSorted
(SortedMap<K, ? extends V> map) Returns an immutable map containing the same entries as the provided sorted map, with the same ordering.(package private) ImmutableSet
<Map.Entry<K, V>> (package private) ImmutableSet
<K> (package private) ImmutableCollection
<V> (package private) static <K,
V> ImmutableSortedMap <K, V> emptyMap
(Comparator<? super K> comparator) entrySet()
Returns an immutable set of the mappings in this map, sorted by the key ordering.firstKey()
floorEntry
(K key) void
forEach
(BiConsumer<? super K, ? super V> action) private static <K,
V> ImmutableSortedMap <K, V> fromEntries
(Comparator<? super K> comparator, boolean sameComparator, Iterable<? extends Map.Entry<? extends K, ? extends V>> entries) Accepts a collection of possibly-null entries.private static <K,
V> ImmutableSortedMap <K, V> fromEntries
(Comparator<? super K> comparator, boolean sameComparator, Map.Entry<K, V>[] entryArray, int size) private static <K extends Comparable<? super K>,
V>
ImmutableSortedMap<K, V> fromEntries
(Map.Entry<K, V>... entries) private ImmutableSortedMap
<K, V> getSubMap
(int fromIndex, int toIndex) This method returns aImmutableSortedMap
, consisting of the entries whose keys are less thantoKey
.This method returns aImmutableSortedMap
, consisting of the entries whose keys are less than (or equal to, ifinclusive
)toKey
.higherEntry
(K key) (package private) boolean
keySet()
Returns an immutable sorted set of the keys in this map.lastKey()
lowerEntry
(K key) static <K extends Comparable<?>,
V>
ImmutableSortedMap.Builder<K, V> Returns a builder that creates immutable sorted maps whose keys are ordered by their natural ordering.static <K,
V> ImmutableSortedMap <K, V> of()
Returns the empty sorted map.private static <K,
V> ImmutableSortedMap <K, V> of
(Comparator<? super K> comparator, K k1, V v1) Returns an immutable map containing a single entry.static <K extends Comparable<? super K>,
V>
ImmutableSortedMap<K, V> of
(K k1, V v1) Returns an immutable map containing a single entry.static <K extends Comparable<? super K>,
V>
ImmutableSortedMap<K, V> of
(K k1, V v1, K k2, V v2) Returns an immutable sorted map containing the given entries, sorted by the natural ordering of their keys.static <K extends Comparable<? super K>,
V>
ImmutableSortedMap<K, V> of
(K k1, V v1, K k2, V v2, K k3, V v3) Returns an immutable sorted map containing the given entries, sorted by the natural ordering of their keys.static <K extends Comparable<? super K>,
V>
ImmutableSortedMap<K, V> of
(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) Returns an immutable sorted map containing the given entries, sorted by the natural ordering of their keys.static <K extends Comparable<? super K>,
V>
ImmutableSortedMap<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 immutable sorted map containing the given entries, sorted by the natural ordering of their keys.static <K extends Comparable<? super K>,
V>
ImmutableSortedMap<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 immutable sorted map containing the given entries, sorted by the natural ordering of their keys.static <K extends Comparable<? super K>,
V>
ImmutableSortedMap<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 immutable sorted map containing the given entries, sorted by the natural ordering of their keys.static <K extends Comparable<? super K>,
V>
ImmutableSortedMap<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 immutable sorted map containing the given entries, sorted by the natural ordering of their keys.static <K extends Comparable<? super K>,
V>
ImmutableSortedMap<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 immutable sorted map containing the given entries, sorted by the natural ordering of their keys.static <K extends Comparable<? super K>,
V>
ImmutableSortedMap<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 immutable sorted map containing the given entries, sorted by the natural ordering of their keys.static <K,
V> ImmutableSortedMap <K, V> Deprecated.UseImmutableSortedMap.copyOf(ImmutableMap.ofEntries(...))
.static <K,
V> ImmutableSortedMap.Builder <K, V> orderedBy
(Comparator<K> comparator) Returns a builder that creates immutable sorted maps with an explicit comparator.Deprecated.Unsupported operation.Deprecated.Unsupported operation.private void
readObject
(ObjectInputStream stream) static <K extends Comparable<?>,
V>
ImmutableSortedMap.Builder<K, V> Returns a builder that creates immutable sorted maps whose keys are ordered by the reverse of their natural ordering.int
size()
This method returns aImmutableSortedMap
, consisting of the entries whose keys ranges fromfromKey
totoKey
, inclusive or exclusive as indicated by the boolean flags.This method returns aImmutableSortedMap
, consisting of the entries whose keys ranges fromfromKey
, inclusive, totoKey
, exclusive.This method returns aImmutableSortedMap
, consisting of the entries whose keys are greater than or equals tofromKey
.This method returns aImmutableSortedMap
, consisting of the entries whose keys are greater than (or equal to, ifinclusive
)fromKey
.static <T,
K, V> Collector <T, ?, ImmutableMap<K, V>> toImmutableMap
(Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction) static <T,
K, V> Collector <T, ?, ImmutableMap<K, V>> toImmutableMap
(Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction, BinaryOperator<V> mergeFunction) static <T,
K, V> Collector <T, ?, ImmutableSortedMap<K, V>> toImmutableSortedMap
(Comparator<? super K> comparator, Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction) Returns aCollector
that accumulates elements into anImmutableSortedMap
whose keys and values are the result of applying the provided mapping functions to the input elements.static <T,
K, V> Collector <T, ?, ImmutableSortedMap<K, V>> toImmutableSortedMap
(Comparator<? super K> comparator, Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction, BinaryOperator<V> mergeFunction) Returns aCollector
that accumulates elements into anImmutableSortedMap
whose keys and values are the result of applying the provided mapping functions to the input elements.values()
Returns an immutable collection of the values in this map, sorted by the ordering of the corresponding keys.(package private) Object
Returns a serializable form of this object.Methods inherited from class com.google.common.collect.ImmutableMap
asMultimap, checkNoConflict, clear, compute, computeIfAbsent, computeIfPresent, conflictException, containsKey, containsValue, entryOf, equals, getOrDefault, hashCode, isEmpty, isHashCodeFast, keyIterator, keySpliterator, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, getOrDefault, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll
Methods inherited from interface java.util.NavigableMap
reversed
Methods inherited from interface java.util.SequencedMap
sequencedEntrySet, sequencedKeySet, sequencedValues
-
Field Details
-
NATURAL_ORDER
-
NATURAL_EMPTY_MAP
-
keySet
-
valueList
-
descendingMap
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
-
Constructor Details
-
ImmutableSortedMap
ImmutableSortedMap(RegularImmutableSortedSet<K> keySet, ImmutableList<V> valueList) -
ImmutableSortedMap
ImmutableSortedMap(RegularImmutableSortedSet<K> keySet, ImmutableList<V> valueList, @CheckForNull ImmutableSortedMap<K, V> descendingMap)
-
-
Method Details
-
toImmutableSortedMap
public static <T,K, Collector<T,V> ?, toImmutableSortedMapImmutableSortedMap<K, V>> (Comparator<? super K> comparator, Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction) Returns aCollector
that accumulates elements into anImmutableSortedMap
whose keys and values are the result of applying the provided mapping functions to the input elements. The generated map is sorted by the specified comparator.If the mapped keys contain duplicates (according to the specified comparator), an
IllegalArgumentException
is thrown when the collection operation is performed. (This differs from theCollector
returned byCollectors.toMap(Function, Function)
, which throws anIllegalStateException
.)- Since:
- 21.0
-
toImmutableSortedMap
public static <T,K, Collector<T,V> ?, toImmutableSortedMapImmutableSortedMap<K, V>> (Comparator<? super K> comparator, Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction, BinaryOperator<V> mergeFunction) Returns aCollector
that accumulates elements into anImmutableSortedMap
whose keys and values are the result of applying the provided mapping functions to the input elements.If the mapped keys contain duplicates (according to the comparator), the values are merged using the specified merging function. Entries will appear in the encounter order of the first occurrence of the key.
- Since:
- 21.0
-
emptyMap
-
of
Returns the empty sorted map.Performance note: the instance returned is a singleton.
-
of
Returns an immutable map containing a single entry. -
of
Returns an immutable map containing a single entry. -
of
public static <K extends Comparable<? super K>,V> ImmutableSortedMap<K,V> of(K k1, V v1, K k2, V v2) Returns an immutable sorted map containing the given entries, sorted by the natural ordering of their keys.- Throws:
IllegalArgumentException
- if the two keys are equal according to their natural ordering
-
of
public static <K extends Comparable<? super K>,V> ImmutableSortedMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3) Returns an immutable sorted map containing the given entries, sorted by the natural ordering of their keys.- Throws:
IllegalArgumentException
- if any two keys are equal according to their natural ordering
-
of
public static <K extends Comparable<? super K>,V> ImmutableSortedMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) Returns an immutable sorted map containing the given entries, sorted by the natural ordering of their keys.- Throws:
IllegalArgumentException
- if any two keys are equal according to their natural ordering
-
of
public static <K extends Comparable<? super K>,V> ImmutableSortedMap<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 immutable sorted map containing the given entries, sorted by the natural ordering of their keys.- Throws:
IllegalArgumentException
- if any two keys are equal according to their natural ordering
-
of
public static <K extends Comparable<? super K>,V> ImmutableSortedMap<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 immutable sorted map containing the given entries, sorted by the natural ordering of their keys.- Throws:
IllegalArgumentException
- if any two keys are equal according to their natural ordering- Since:
- 31.0
-
of
public static <K extends Comparable<? super K>,V> ImmutableSortedMap<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 immutable sorted map containing the given entries, sorted by the natural ordering of their keys.- Throws:
IllegalArgumentException
- if any two keys are equal according to their natural ordering- Since:
- 31.0
-
of
public static <K extends Comparable<? super K>,V> ImmutableSortedMap<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 immutable sorted map containing the given entries, sorted by the natural ordering of their keys.- Throws:
IllegalArgumentException
- if any two keys are equal according to their natural ordering- Since:
- 31.0
-
of
public static <K extends Comparable<? super K>,V> ImmutableSortedMap<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 immutable sorted map containing the given entries, sorted by the natural ordering of their keys.- Throws:
IllegalArgumentException
- if any two keys are equal according to their natural ordering- Since:
- 31.0
-
of
public static <K extends Comparable<? super K>,V> ImmutableSortedMap<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 immutable sorted map containing the given entries, sorted by the natural ordering of their keys.- Throws:
IllegalArgumentException
- if any two keys are equal according to their natural ordering- Since:
- 31.0
-
copyOf
Returns an immutable map containing the same entries asmap
, sorted by the natural ordering of the keys.Despite the method name, this method attempts to avoid actually copying the data when it is safe to do so. The exact circumstances under which a copy will or will not be performed are undocumented and subject to change.
This method is not type-safe, as it may be called on a map with keys that are not mutually comparable.
- Throws:
ClassCastException
- if the keys inmap
are not mutually comparableNullPointerException
- if any key or value inmap
is nullIllegalArgumentException
- if any two keys are equal according to their natural ordering
-
copyOf
public static <K,V> ImmutableSortedMap<K,V> copyOf(Map<? extends K, ? extends V> map, Comparator<? super K> comparator) Returns an immutable map containing the same entries asmap
, with keys sorted by the provided comparator.Despite the method name, this method attempts to avoid actually copying the data when it is safe to do so. The exact circumstances under which a copy will or will not be performed are undocumented and subject to change.
- Throws:
NullPointerException
- if any key or value inmap
is nullIllegalArgumentException
- if any two keys are equal according to the comparator
-
copyOf
public static <K,V> ImmutableSortedMap<K,V> copyOf(Iterable<? extends Map.Entry<? extends K, ? extends V>> entries) Returns an immutable map containing the given entries, with keys sorted by their natural ordering.This method is not type-safe, as it may be called on a map with keys that are not mutually comparable.
- Throws:
NullPointerException
- if any key or value inmap
is nullIllegalArgumentException
- if any two keys are equal according to the comparator- Since:
- 19.0
-
copyOf
public static <K,V> ImmutableSortedMap<K,V> copyOf(Iterable<? extends Map.Entry<? extends K, ? extends V>> entries, Comparator<? super K> comparator) Returns an immutable map containing the given entries, with keys sorted by the provided comparator.- Throws:
NullPointerException
- if any key or value inmap
is nullIllegalArgumentException
- if any two keys are equal according to the comparator- Since:
- 19.0
-
copyOfSorted
Returns an immutable map containing the same entries as the provided sorted map, with the same ordering.Despite the method name, this method attempts to avoid actually copying the data when it is safe to do so. The exact circumstances under which a copy will or will not be performed are undocumented and subject to change.
- Throws:
NullPointerException
- if any key or value inmap
is null
-
copyOfInternal
private static <K,V> ImmutableSortedMap<K,V> copyOfInternal(Map<? extends K, ? extends V> map, Comparator<? super K> comparator) -
fromEntries
private static <K extends Comparable<? super K>,V> ImmutableSortedMap<K,V> fromEntries(Map.Entry<K, V>... entries) -
fromEntries
private static <K,V> ImmutableSortedMap<K,V> fromEntries(Comparator<? super K> comparator, boolean sameComparator, Iterable<? extends Map.Entry<? extends K, ? extends V>> entries) Accepts a collection of possibly-null entries. IfsameComparator
, then it is assumed that they do not need to be sorted or checked for dupes. -
fromEntries
private static <K,V> ImmutableSortedMap<K,V> fromEntries(Comparator<? super K> comparator, boolean sameComparator, Map.Entry<K, V>[] entryArray, int size) -
naturalOrder
Returns a builder that creates immutable sorted maps whose keys are ordered by their natural ordering. The sorted maps useOrdering.natural()
as the comparator. -
orderedBy
Returns a builder that creates immutable sorted maps with an explicit comparator. If the comparator has a more general type than the map's keys, such as creating aSortedMap<Integer, String>
with aComparator<Number>
, use theImmutableSortedMap.Builder
constructor instead.- Throws:
NullPointerException
- ifcomparator
is null
-
reverseOrder
Returns a builder that creates immutable sorted maps whose keys are ordered by the reverse of their natural ordering. -
size
public int size() -
forEach
-
get
-
isPartialView
boolean isPartialView()- Specified by:
isPartialView
in classImmutableMap<K,
V>
-
entrySet
Returns an immutable set of the mappings in this map, sorted by the key ordering. -
createEntrySet
ImmutableSet<Map.Entry<K,V>> createEntrySet()- Specified by:
createEntrySet
in classImmutableMap<K,
V>
-
keySet
Returns an immutable sorted set of the keys in this map. -
createKeySet
ImmutableSet<K> createKeySet()- Specified by:
createKeySet
in classImmutableMap<K,
V>
-
values
Returns an immutable collection of the values in this map, sorted by the ordering of the corresponding keys. -
createValues
ImmutableCollection<V> createValues()- Specified by:
createValues
in classImmutableMap<K,
V>
-
comparator
Returns the comparator that orders the keys, which isOrdering.natural()
when the natural ordering of the keys is used. Note that its behavior is not consistent withTreeMap.comparator()
, which returnsnull
to indicate natural ordering.- Specified by:
comparator
in interfaceSortedMap<K,
V>
-
firstKey
-
lastKey
-
getSubMap
-
headMap
This method returns aImmutableSortedMap
, consisting of the entries whose keys are less thantoKey
.The
SortedMap.headMap(K)
documentation states that a submap of a submap throws anIllegalArgumentException
if passed atoKey
greater than an earliertoKey
. However, this method doesn't throw an exception in that situation, but instead keeps the originaltoKey
. -
headMap
This method returns aImmutableSortedMap
, consisting of the entries whose keys are less than (or equal to, ifinclusive
)toKey
.The
SortedMap.headMap(K)
documentation states that a submap of a submap throws anIllegalArgumentException
if passed atoKey
greater than an earliertoKey
. However, this method doesn't throw an exception in that situation, but instead keeps the originaltoKey
.- Specified by:
headMap
in interfaceNavigableMap<K,
V> - Since:
- 12.0
-
subMap
This method returns aImmutableSortedMap
, consisting of the entries whose keys ranges fromfromKey
, inclusive, totoKey
, exclusive.The
SortedMap.subMap(K, K)
documentation states that a submap of a submap throws anIllegalArgumentException
if passed afromKey
less than an earlierfromKey
. However, this method doesn't throw an exception in that situation, but instead keeps the originalfromKey
. Similarly, this method keeps the originaltoKey
, instead of throwing an exception, if passed atoKey
greater than an earliertoKey
. -
subMap
public ImmutableSortedMap<K,V> subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive) This method returns aImmutableSortedMap
, consisting of the entries whose keys ranges fromfromKey
totoKey
, inclusive or exclusive as indicated by the boolean flags.The
SortedMap.subMap(K, K)
documentation states that a submap of a submap throws anIllegalArgumentException
if passed afromKey
less than an earlierfromKey
. However, this method doesn't throw an exception in that situation, but instead keeps the originalfromKey
. Similarly, this method keeps the originaltoKey
, instead of throwing an exception, if passed atoKey
greater than an earliertoKey
.- Specified by:
subMap
in interfaceNavigableMap<K,
V> - Since:
- 12.0
-
tailMap
This method returns aImmutableSortedMap
, consisting of the entries whose keys are greater than or equals tofromKey
.The
SortedMap.tailMap(K)
documentation states that a submap of a submap throws anIllegalArgumentException
if passed afromKey
less than an earlierfromKey
. However, this method doesn't throw an exception in that situation, but instead keeps the originalfromKey
. -
tailMap
This method returns aImmutableSortedMap
, consisting of the entries whose keys are greater than (or equal to, ifinclusive
)fromKey
.The
SortedMap.tailMap(K)
documentation states that a submap of a submap throws anIllegalArgumentException
if passed afromKey
less than an earlierfromKey
. However, this method doesn't throw an exception in that situation, but instead keeps the originalfromKey
.- Specified by:
tailMap
in interfaceNavigableMap<K,
V> - Since:
- 12.0
-
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> - Specified by:
firstEntry
in interfaceSequencedMap<K,
V>
-
lastEntry
- Specified by:
lastEntry
in interfaceNavigableMap<K,
V> - Specified by:
lastEntry
in interfaceSequencedMap<K,
V>
-
pollFirstEntry
Deprecated.Unsupported operation.Guaranteed to throw an exception and leave the map unmodified.- Specified by:
pollFirstEntry
in interfaceNavigableMap<K,
V> - Specified by:
pollFirstEntry
in interfaceSequencedMap<K,
V> - Throws:
UnsupportedOperationException
- always
-
pollLastEntry
Deprecated.Unsupported operation.Guaranteed to throw an exception and leave the map unmodified.- Specified by:
pollLastEntry
in interfaceNavigableMap<K,
V> - Specified by:
pollLastEntry
in interfaceSequencedMap<K,
V> - Throws:
UnsupportedOperationException
- always
-
descendingMap
- Specified by:
descendingMap
in interfaceNavigableMap<K,
V>
-
descendingKeySet
- Specified by:
descendingKeySet
in interfaceNavigableMap<K,
V>
-
writeReplace
Object writeReplace()Description copied from class:ImmutableMap
Returns a serializable form of this object. Non-public subclasses should not override this method. Publicly-accessible subclasses must override this method and should return a subclass of SerializedForm whose readResolve() method returns objects of the subclass type.- Overrides:
writeReplace
in classImmutableMap<K,
V>
-
readObject
- Throws:
InvalidObjectException
-
toImmutableMap
@Deprecated public static <T,K, Collector<T,V> ?, toImmutableMapImmutableMap<K, V>> (Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction) Not supported. UsetoImmutableSortedMap(java.util.Comparator<? super K>, java.util.function.Function<? super T, ? extends K>, java.util.function.Function<? super T, ? extends V>)
, which offers better type-safety, instead. This method exists only to hideImmutableMap.toImmutableMap(java.util.function.Function<? super T, ? extends K>, java.util.function.Function<? super T, ? extends V>)
from consumers ofImmutableSortedMap
.- Throws:
UnsupportedOperationException
- always
-
toImmutableMap
@Deprecated public static <T,K, Collector<T,V> ?, toImmutableMapImmutableMap<K, V>> (Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction, BinaryOperator<V> mergeFunction) Not supported. UsetoImmutableSortedMap(java.util.Comparator<? super K>, java.util.function.Function<? super T, ? extends K>, java.util.function.Function<? super T, ? extends V>)
, which offers better type-safety, instead. This method exists only to hideImmutableMap.toImmutableMap(java.util.function.Function<? super T, ? extends K>, java.util.function.Function<? super T, ? extends V>)
from consumers ofImmutableSortedMap
.- Throws:
UnsupportedOperationException
- always
-
builder
Deprecated.UsenaturalOrder()
, which offers better type-safety.Not supported. UsenaturalOrder()
, which offers better type-safety, instead. This method exists only to hideImmutableMap.builder()
from consumers ofImmutableSortedMap
.- Throws:
UnsupportedOperationException
- always
-
builderWithExpectedSize
@Deprecated public static <K,V> ImmutableSortedMap.Builder<K,V> builderWithExpectedSize(int expectedSize) Deprecated.Not supported for ImmutableSortedMap.Not supported for ImmutableSortedMap.- Throws:
UnsupportedOperationException
- always
-
of
Deprecated.Pass a key of typeComparable
to useof(Comparable, Object)
.Not supported. You are attempting to create a map that may contain a non-Comparable
key. Proper calls will resolve to the version inImmutableSortedMap
, not this dummy version.- Throws:
UnsupportedOperationException
- always
-
of
Deprecated.Pass keys of typeComparable
to useof(Comparable, Object, Comparable, Object)
.Not supported. You are attempting to create a map that may contain non-Comparable
keys. Proper calls will resolve to the version inImmutableSortedMap
, not this dummy version.- Throws:
UnsupportedOperationException
- always
-
of
Deprecated.Pass keys of typeComparable
to useof(Comparable, Object, Comparable, Object, Comparable, Object)
.Not supported. You are attempting to create a map that may contain non-Comparable
keys. Proper calls to will resolve to the version inImmutableSortedMap
, not this dummy version.- Throws:
UnsupportedOperationException
- always
-
of
@Deprecated public static <K,V> ImmutableSortedMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) Deprecated.Pass keys of typeComparable
to useof(Comparable, Object, Comparable, Object, Comparable, Object, Comparable, Object)
.Not supported. You are attempting to create a map that may contain non-Comparable
keys. Proper calls will resolve to the version inImmutableSortedMap
, not this dummy version.- Throws:
UnsupportedOperationException
- always
-
of
@Deprecated public static <K,V> ImmutableSortedMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) Deprecated.Pass keys of typeComparable
to useof(Comparable, Object, Comparable, Object, Comparable, Object, Comparable, Object, Comparable, Object)
.Not supported. You are attempting to create a map that may contain non-Comparable
keys. Proper calls will resolve to the version inImmutableSortedMap
, not this dummy version.- Throws:
UnsupportedOperationException
- always
-
of
@Deprecated public static <K,V> ImmutableSortedMap<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) Deprecated.Pass keys of typeComparable
to useof(Comparable, Object, Comparable, Object, Comparable, Object, Comparable, Object, Comparable, Object)
.Not supported. You are attempting to create a map that may contain non-Comparable
keys. Proper calls will resolve to the version inImmutableSortedMap
, not this dummy version.- Throws:
UnsupportedOperationException
- always
-
of
@Deprecated public static <K,V> ImmutableSortedMap<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) Deprecated.Pass keys of typeComparable
to useof(Comparable, Object, Comparable, Object, Comparable, Object, Comparable, Object, Comparable, Object)
.Not supported. You are attempting to create a map that may contain non-Comparable
keys. Proper calls will resolve to the version inImmutableSortedMap
, not this dummy version.- Throws:
UnsupportedOperationException
- always
-
of
@Deprecated public static <K,V> ImmutableSortedMap<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) Deprecated.Pass keys of typeComparable
to useof(Comparable, Object, Comparable, Object, Comparable, Object, Comparable, Object, Comparable, Object)
.Not supported. You are attempting to create a map that may contain non-Comparable
keys. Proper calls will resolve to the version inImmutableSortedMap
, not this dummy version.- Throws:
UnsupportedOperationException
- always
-
of
@Deprecated public static <K,V> ImmutableSortedMap<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) Deprecated.Pass keys of typeComparable
to useof(Comparable, Object, Comparable, Object, Comparable, Object, Comparable, Object, Comparable, Object)
.Not supported. You are attempting to create a map that may contain non-Comparable
keys. Proper calls will resolve to the version inImmutableSortedMap
, not this dummy version.- Throws:
UnsupportedOperationException
- always
-
of
@Deprecated public static <K,V> ImmutableSortedMap<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) Deprecated.Pass keys of typeComparable
to useof(Comparable, Object, Comparable, Object, Comparable, Object, Comparable, Object, Comparable, Object)
.Not supported. You are attempting to create a map that may contain non-Comparable
keys. Proper calls will resolve to the version inImmutableSortedMap
, not this dummy version.- Throws:
UnsupportedOperationException
- always
-
ofEntries
@Deprecated @SafeVarargs public static <K,V> ImmutableSortedMap<K,V> ofEntries(Map.Entry<? extends K, ? extends V>... entries) Deprecated.UseImmutableSortedMap.copyOf(ImmutableMap.ofEntries(...))
.Not supported. UseImmutableSortedMap.copyOf(ImmutableMap.ofEntries(...))
.
-
naturalOrder()
, which offers better type-safety.