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.
NavigableMap since 12.0)
| Modifier and Type | Class and Description |
|---|---|
| public static class | ImmutableSortedMap.
A builder for creating immutable sorted map instances, especially |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private transient ImmutableSortedMap | |
| private final transient RegularImmutableSortedSet | |
| private static final ImmutableSortedMap | |
| private static final Comparator | |
| private static final long | |
| private final transient ImmutableList |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| pack-priv | ImmutableSortedMap(RegularImmutableSortedSet<K> keySet, ImmutableList<V> valueList, ImmutableSortedMap<K, V> descendingMap)
|
| Modifier and Type | Method and Description |
|---|---|
| public static <K, V> ImmutableSortedMap. | builder()
Hides com.
Deprecated
Use
Not supported.
ImmutableSortedMap#naturalOrder, which offers better type-safety.
|
| public static <K, V> ImmutableSortedMap. | builderWithExpectedSize(int expectedSize)
Hides com.
Deprecated
Not supported for ImmutableSortedMap.
Not supported for ImmutableSortedMap.
|
| public Map. | ceilingEntry(K
the key key)Implements java. null if
there is no such key.
|
| public K | ceilingKey(K
the key key)Implements java. null if there is no such key.
|
| public Comparator | comparator()
Implements java. Ordering#natural() when the
natural ordering of the keys is used.
|
| public static <K, V> ImmutableSortedMap | copyOf(Map<? extends K, ? extends V>
a map)Map from which entries are drawn, must be non-nullHides com. map, sorted by the natural
ordering of the keys.
|
| public static <K, V> ImmutableSortedMap | copyOf(Map<? extends K, ? extends V> map, Comparator<? super K> comparator)
Returns an immutable map containing the same entries as |
| public static <K, V> ImmutableSortedMap | |
| public static <K, V> ImmutableSortedMap | copyOf(Iterable<? extends Map.
Returns an immutable map containing the given entries, with keys sorted by the provided comparator. |
| private static <K, V> ImmutableSortedMap | |
| public static <K, V> ImmutableSortedMap | copyOfSorted(SortedMap<K, ? extends V> map)
Returns an immutable map containing the same entries as the provided sorted map, with the same ordering. |
| pack-priv ImmutableSet | |
| pack-priv ImmutableSet | |
| pack-priv ImmutableCollection | |
| public ImmutableSortedSet | descendingKeySet()
Implements java. NavigableSet view of the keys contained in this map.
|
| public ImmutableSortedMap | descendingMap()
Implements java. |
| pack-priv static <K, V> ImmutableSortedMap | |
| public ImmutableSet | entrySet()
Overrides com. Implements java. |
| public Map. | firstEntry()
Implements java. null if the map is empty.
|
| public K | firstKey()
Implements java. |
| public Map. | floorEntry(K
the key key)Implements java. null if there
is no such key.
|
| public K | floorKey(K
the key key)Implements java. null if there is no such key.
|
| public void | forEach(BiConsumer<? super K, ? super V>
The action to be performed for each entry action)Overrides default java. |
| private static <K extends Comparable | |
| private static <K, V> ImmutableSortedMap | fromEntries(Comparator<? super K> comparator, boolean sameComparator, Iterable<? extends Map.
Accepts a collection of possibly-null entries. |
| private static <K, V> ImmutableSortedMap | fromEntries(final Comparator<? super K> comparator, boolean sameComparator, @Nullable Map.
|
| public V | get(Object
the key whose associated value is to be returned key)Implements abstract com. Implements java. null if this map contains no mapping for the key.
|
| private ImmutableSortedMap | |
| public ImmutableSortedMap | headMap(K
high endpoint (exclusive) of the keys in the returned map toKey)Implements java. ImmutableSortedMap, consisting of the entries whose keys are less
than toKey.
|
| public ImmutableSortedMap | headMap(K
high endpoint of the keys in the returned map toKey, boolean true if the high endpoint
is to be included in the returned viewImplements java. ImmutableSortedMap, consisting of the entries whose keys are less
than (or equal to, if inclusive) toKey.
|
| public Map. | higherEntry(K
the key key)Implements java. null if there
is no such key.
|
| public K | higherKey(K
the key key)Implements java. null if there is no such key.
|
| pack-priv boolean | |
| public ImmutableSortedSet | keySet()
Overrides com. Implements java. |
| public Map. | lastEntry()
Implements java. null if the map is empty.
|
| public K | lastKey()
Implements java. |
| public Map. | lowerEntry(K
the key key)Implements java. null if there is
no such key.
|
| public K | lowerKey(K
the key key)Implements java. null if there is no such key.
|
| public static <K extends Comparable | naturalOrder()
Returns a builder that creates immutable sorted maps whose keys are ordered by their natural ordering. |
| public ImmutableSortedSet | navigableKeySet()
Implements java. NavigableSet view of the keys contained in this map.
|
| public static <K, V> ImmutableSortedMap | of()
Hides com. |
| public static <K extends Comparable | of(K
the mapping's key k1, V the mapping's value v1)Hides com. |
| private static <K, V> ImmutableSortedMap | |
| public static <K extends Comparable | of(K
the first mapping's key k1, V the first mapping's value v1, K the second mapping's key k2, V the second mapping's value v2)Hides com. |
| public static <K extends Comparable | of(K
the first mapping's key k1, V the first mapping's value v1, K the second mapping's key k2, V the second mapping's value v2, K the third mapping's key k3, V the third mapping's value v3)Hides com. |
| public static <K extends Comparable | of(K
the first mapping's key k1, V the first mapping's value v1, K the second mapping's key k2, V the second mapping's value v2, K the third mapping's key k3, V the third mapping's value v3, K the fourth mapping's key k4, V the fourth mapping's value v4)Hides com. |
| public static <K extends Comparable | of(K
the first mapping's key k1, V the first mapping's value v1, K the second mapping's key k2, V the second mapping's value v2, K the third mapping's key k3, V the third mapping's value v3, K the fourth mapping's key k4, V the fourth mapping's value v4, K the fifth mapping's key k5, V the fifth mapping's value v5)Hides com. |
| public static <K extends Comparable | of(K
the first mapping's key k1, V the first mapping's value v1, K the second mapping's key k2, V the second mapping's value v2, K the third mapping's key k3, V the third mapping's value v3, K the fourth mapping's key k4, V the fourth mapping's value v4, K the fifth mapping's key k5, V the fifth mapping's value v5, K the sixth mapping's key k6, V the sixth mapping's value v6)Hides com. |
| public static <K extends Comparable | of(K
the first mapping's key k1, V the first mapping's value v1, K the second mapping's key k2, V the second mapping's value v2, K the third mapping's key k3, V the third mapping's value v3, K the fourth mapping's key k4, V the fourth mapping's value v4, K the fifth mapping's key k5, V the fifth mapping's value v5, K the sixth mapping's key k6, V the sixth mapping's value v6, K the seventh mapping's key k7, V the seventh mapping's value v7)Hides com. |
| public static <K extends Comparable | of(K
the first mapping's key k1, V the first mapping's value v1, K the second mapping's key k2, V the second mapping's value v2, K the third mapping's key k3, V the third mapping's value v3, K the fourth mapping's key k4, V the fourth mapping's value v4, K the fifth mapping's key k5, V the fifth mapping's value v5, K the sixth mapping's key k6, V the sixth mapping's value v6, K the seventh mapping's key k7, V the seventh mapping's value v7, K the eighth mapping's key k8, V the eighth mapping's value v8)Hides com. |
| public static <K extends Comparable | of(K
the first mapping's key k1, V the first mapping's value v1, K the second mapping's key k2, V the second mapping's value v2, K the third mapping's key k3, V the third mapping's value v3, K the fourth mapping's key k4, V the fourth mapping's value v4, K the fifth mapping's key k5, V the fifth mapping's value v5, K the sixth mapping's key k6, V the sixth mapping's value v6, K the seventh mapping's key k7, V the seventh mapping's value v7, K the eighth mapping's key k8, V the eighth mapping's value v8, K the ninth mapping's key k9, V the ninth mapping's value v9)Hides com. |
| public static <K extends Comparable | of(K
the first mapping's key k1, V the first mapping's value v1, K the second mapping's key k2, V the second mapping's value v2, K the third mapping's key k3, V the third mapping's value v3, K the fourth mapping's key k4, V the fourth mapping's value v4, K the fifth mapping's key k5, V the fifth mapping's value v5, K the sixth mapping's key k6, V the sixth mapping's value v6, K the seventh mapping's key k7, V the seventh mapping's value v7, K the eighth mapping's key k8, V the eighth mapping's value v8, K the ninth mapping's key k9, V the ninth mapping's value v9, K the tenth mapping's key k10, V the tenth mapping's value v10)Hides com. |
| public static <K, V> ImmutableSortedMap | of(K
the mapping's key k1, V the mapping's value v1)Hides com.
Deprecated
Pass a key of type
Not supported.
Comparable to use ImmutableSortedMap#of(Comparable, Object).
|
| public static <K, V> ImmutableSortedMap | of(K
the first mapping's key k1, V the first mapping's value v1, K the second mapping's key k2, V the second mapping's value v2)Hides com.
Deprecated
Pass keys of type
Not supported.
Comparable to use ImmutableSortedMap#of(Comparable, Object, Comparable, Object).
|
| public static <K, V> ImmutableSortedMap | of(K
the first mapping's key k1, V the first mapping's value v1, K the second mapping's key k2, V the second mapping's value v2, K the third mapping's key k3, V the third mapping's value v3)Hides com.
Deprecated
Pass keys of type
Not supported.
Comparable to use ImmutableSortedMap#of(Comparable, Object, Comparable, Object, Comparable, Object).
|
| public static <K, V> ImmutableSortedMap | of(K
the first mapping's key k1, V the first mapping's value v1, K the second mapping's key k2, V the second mapping's value v2, K the third mapping's key k3, V the third mapping's value v3, K the fourth mapping's key k4, V the fourth mapping's value v4)Hides com.
Deprecated
Pass keys of type
Not supported.
Comparable to use ImmutableSortedMap#of(Comparable, Object, Comparable, Object, Comparable, Object,
Comparable, Object).
|
| public static <K, V> ImmutableSortedMap | of(K
the first mapping's key k1, V the first mapping's value v1, K the second mapping's key k2, V the second mapping's value v2, K the third mapping's key k3, V the third mapping's value v3, K the fourth mapping's key k4, V the fourth mapping's value v4, K the fifth mapping's key k5, V the fifth mapping's value v5)Hides com.
Deprecated
Pass keys of type
Not supported.
Comparable to use ImmutableSortedMap#of(Comparable, Object, Comparable, Object, Comparable, Object,
Comparable, Object, Comparable, Object).
|
| public static <K, V> ImmutableSortedMap | of(K
the first mapping's key k1, V the first mapping's value v1, K the second mapping's key k2, V the second mapping's value v2, K the third mapping's key k3, V the third mapping's value v3, K the fourth mapping's key k4, V the fourth mapping's value v4, K the fifth mapping's key k5, V the fifth mapping's value v5, K the sixth mapping's key k6, V the sixth mapping's value v6)Hides com.
Deprecated
Pass keys of type
Not supported.
Comparable to use ImmutableSortedMap#of(Comparable, Object, Comparable, Object, Comparable, Object,
Comparable, Object, Comparable, Object).
|
| public static <K, V> ImmutableSortedMap | of(K
the first mapping's key k1, V the first mapping's value v1, K the second mapping's key k2, V the second mapping's value v2, K the third mapping's key k3, V the third mapping's value v3, K the fourth mapping's key k4, V the fourth mapping's value v4, K the fifth mapping's key k5, V the fifth mapping's value v5, K the sixth mapping's key k6, V the sixth mapping's value v6, K the seventh mapping's key k7, V the seventh mapping's value v7)Hides com.
Deprecated
Pass keys of type
Not supported.
Comparable to use ImmutableSortedMap#of(Comparable, Object, Comparable, Object, Comparable, Object,
Comparable, Object, Comparable, Object).
|
| public static <K, V> ImmutableSortedMap | of(K
the first mapping's key k1, V the first mapping's value v1, K the second mapping's key k2, V the second mapping's value v2, K the third mapping's key k3, V the third mapping's value v3, K the fourth mapping's key k4, V the fourth mapping's value v4, K the fifth mapping's key k5, V the fifth mapping's value v5, K the sixth mapping's key k6, V the sixth mapping's value v6, K the seventh mapping's key k7, V the seventh mapping's value v7, K the eighth mapping's key k8, V the eighth mapping's value v8)Hides com.
Deprecated
Pass keys of type
Not supported.
Comparable to use ImmutableSortedMap#of(Comparable, Object, Comparable, Object, Comparable, Object,
Comparable, Object, Comparable, Object).
|
| public static <K, V> ImmutableSortedMap | of(K
the first mapping's key k1, V the first mapping's value v1, K the second mapping's key k2, V the second mapping's value v2, K the third mapping's key k3, V the third mapping's value v3, K the fourth mapping's key k4, V the fourth mapping's value v4, K the fifth mapping's key k5, V the fifth mapping's value v5, K the sixth mapping's key k6, V the sixth mapping's value v6, K the seventh mapping's key k7, V the seventh mapping's value v7, K the eighth mapping's key k8, V the eighth mapping's value v8, K the ninth mapping's key k9, V the ninth mapping's value v9)Hides com.
Deprecated
Pass keys of type
Not supported.
Comparable to use ImmutableSortedMap#of(Comparable, Object, Comparable, Object, Comparable, Object,
Comparable, Object, Comparable, Object).
|
| public static <K, V> ImmutableSortedMap | of(K
the first mapping's key k1, V the first mapping's value v1, K the second mapping's key k2, V the second mapping's value v2, K the third mapping's key k3, V the third mapping's value v3, K the fourth mapping's key k4, V the fourth mapping's value v4, K the fifth mapping's key k5, V the fifth mapping's value v5, K the sixth mapping's key k6, V the sixth mapping's value v6, K the seventh mapping's key k7, V the seventh mapping's value v7, K the eighth mapping's key k8, V the eighth mapping's value v8, K the ninth mapping's key k9, V the ninth mapping's value v9, K the tenth mapping's key k10, V the tenth mapping's value v10)Hides com.
Deprecated
Pass keys of type
Not supported.
Comparable to use ImmutableSortedMap#of(Comparable, Object, Comparable, Object, Comparable, Object,
Comparable, Object, Comparable, Object).
|
| public static <K, V> ImmutableSortedMap | ofEntries(Map.
Map.Entrys containing the keys and values from which the map is populatedHides com.
Deprecated
Use
Not supported.
ImmutableSortedMap.copyOf(ImmutableMap.ofEntries(...)).
|
| public static <K, V> ImmutableSortedMap. | orderedBy(Comparator<K> comparator)
Returns a builder that creates immutable sorted maps with an explicit comparator. |
| public final Map. | pollFirstEntry()
Implements java.
Deprecated
Unsupported operation.
Guaranteed to throw an exception and leave the map unmodified.
|
| public final Map. | pollLastEntry()
Implements java.
Deprecated
Unsupported operation.
Guaranteed to throw an exception and leave the map unmodified.
|
| private void | |
| public static <K extends Comparable | reverseOrder()
Returns a builder that creates immutable sorted maps whose keys are ordered by the reverse of their natural ordering. |
| public int | |
| public ImmutableSortedMap | subMap(K
low endpoint (inclusive) of the keys in the returned map fromKey, K high endpoint (exclusive) of the keys in the returned map toKey)Implements java. ImmutableSortedMap, consisting of the entries whose keys ranges
from fromKey, inclusive, to toKey, exclusive.
|
| public ImmutableSortedMap | subMap(K
low endpoint of the keys in the returned map fromKey, boolean true if the low endpoint
is to be included in the returned viewhigh endpoint of the keys in the returned map toKey, boolean true if the high endpoint
is to be included in the returned viewImplements java. ImmutableSortedMap, consisting of the entries whose keys ranges
from fromKey to toKey, inclusive or exclusive as indicated by the boolean
flags.
|
| public ImmutableSortedMap | tailMap(K
low endpoint (inclusive) of the keys in the returned map fromKey)Implements java. ImmutableSortedMap, consisting of the entries whose keys are
greater than or equals to fromKey.
|
| public ImmutableSortedMap | tailMap(K
low endpoint of the keys in the returned map fromKey, boolean true if the low endpoint
is to be included in the returned viewImplements java. ImmutableSortedMap, consisting of the entries whose keys are
greater than (or equal to, if inclusive) fromKey.
|
| public static <T extends @Nullable Object, K, V> Collector | toImmutableMap(Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction)
Hides com.
Deprecated
Use
Not supported.
ImmutableSortedMap#toImmutableSortedMap.
|
| public static <T extends @Nullable Object, K, V> Collector | toImmutableMap(Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction, BinaryOperator<V> mergeFunction)
Hides com.
Deprecated
Use
Not supported.
ImmutableSortedMap#toImmutableSortedMap.
|
| public static <T extends @Nullable Object, K, V> Collector | toImmutableSortedMap(Comparator<? super K> comparator, Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction)
Returns a |
| public static <T extends @Nullable Object, K, V> Collector | toImmutableSortedMap(Comparator<? super K> comparator, Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction, BinaryOperator<V> mergeFunction)
Returns a |
| public ImmutableCollection | values()
Overrides com. Implements java. |
| pack-priv Object | writeReplace()
Overrides com. |