Class ImmutableSortedMap<K,​V>

    • Method Detail

      • of

        public static <K,​V> ImmutableSortedMap<K,​V> of()
        Returns the empty sorted map.

        Performance note: the instance returned is a singleton.

        Type Parameters:
        K - the Map's key type
        V - the Map's value type
        Returns:
        an empty Map
      • of

        public static <K extends Comparable<? super K>,​V> ImmutableSortedMap<K,​V> of​(K k1,
                                                                                                 V v1)
        Returns an immutable map containing a single entry.
        Type Parameters:
        K - the Map's key type
        V - the Map's value type
        Parameters:
        k1 - the mapping's key
        v1 - the mapping's value
        Returns:
        a Map containing the specified mapping
      • 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.
        Type Parameters:
        K - the Map's key type
        V - the Map's value type
        Parameters:
        k1 - the first mapping's key
        v1 - the first mapping's value
        k2 - the second mapping's key
        v2 - the second mapping's value
        Returns:
        a Map containing the specified mappings
        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.
        Type Parameters:
        K - the Map's key type
        V - the Map's value type
        Parameters:
        k1 - the first mapping's key
        v1 - the first mapping's value
        k2 - the second mapping's key
        v2 - the second mapping's value
        k3 - the third mapping's key
        v3 - the third mapping's value
        Returns:
        a Map containing the specified mappings
        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.
        Type Parameters:
        K - the Map's key type
        V - the Map's value type
        Parameters:
        k1 - the first mapping's key
        v1 - the first mapping's value
        k2 - the second mapping's key
        v2 - the second mapping's value
        k3 - the third mapping's key
        v3 - the third mapping's value
        k4 - the fourth mapping's key
        v4 - the fourth mapping's value
        Returns:
        a Map containing the specified mappings
        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.
        Type Parameters:
        K - the Map's key type
        V - the Map's value type
        Parameters:
        k1 - the first mapping's key
        v1 - the first mapping's value
        k2 - the second mapping's key
        v2 - the second mapping's value
        k3 - the third mapping's key
        v3 - the third mapping's value
        k4 - the fourth mapping's key
        v4 - the fourth mapping's value
        k5 - the fifth mapping's key
        v5 - the fifth mapping's value
        Returns:
        a Map containing the specified mappings
        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.
        Type Parameters:
        K - the Map's key type
        V - the Map's value type
        Parameters:
        k1 - the first mapping's key
        v1 - the first mapping's value
        k2 - the second mapping's key
        v2 - the second mapping's value
        k3 - the third mapping's key
        v3 - the third mapping's value
        k4 - the fourth mapping's key
        v4 - the fourth mapping's value
        k5 - the fifth mapping's key
        v5 - the fifth mapping's value
        k6 - the sixth mapping's key
        v6 - the sixth mapping's value
        Returns:
        a Map containing the specified mappings
        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.
        Type Parameters:
        K - the Map's key type
        V - the Map's value type
        Parameters:
        k1 - the first mapping's key
        v1 - the first mapping's value
        k2 - the second mapping's key
        v2 - the second mapping's value
        k3 - the third mapping's key
        v3 - the third mapping's value
        k4 - the fourth mapping's key
        v4 - the fourth mapping's value
        k5 - the fifth mapping's key
        v5 - the fifth mapping's value
        k6 - the sixth mapping's key
        v6 - the sixth mapping's value
        k7 - the seventh mapping's key
        v7 - the seventh mapping's value
        Returns:
        a Map containing the specified mappings
        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.
        Type Parameters:
        K - the Map's key type
        V - the Map's value type
        Parameters:
        k1 - the first mapping's key
        v1 - the first mapping's value
        k2 - the second mapping's key
        v2 - the second mapping's value
        k3 - the third mapping's key
        v3 - the third mapping's value
        k4 - the fourth mapping's key
        v4 - the fourth mapping's value
        k5 - the fifth mapping's key
        v5 - the fifth mapping's value
        k6 - the sixth mapping's key
        v6 - the sixth mapping's value
        k7 - the seventh mapping's key
        v7 - the seventh mapping's value
        k8 - the eighth mapping's key
        v8 - the eighth mapping's value
        Returns:
        a Map containing the specified mappings
        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.
        Type Parameters:
        K - the Map's key type
        V - the Map's value type
        Parameters:
        k1 - the first mapping's key
        v1 - the first mapping's value
        k2 - the second mapping's key
        v2 - the second mapping's value
        k3 - the third mapping's key
        v3 - the third mapping's value
        k4 - the fourth mapping's key
        v4 - the fourth mapping's value
        k5 - the fifth mapping's key
        v5 - the fifth mapping's value
        k6 - the sixth mapping's key
        v6 - the sixth mapping's value
        k7 - the seventh mapping's key
        v7 - the seventh mapping's value
        k8 - the eighth mapping's key
        v8 - the eighth mapping's value
        k9 - the ninth mapping's key
        v9 - the ninth mapping's value
        Returns:
        a Map containing the specified mappings
        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.
        Type Parameters:
        K - the Map's key type
        V - the Map's value type
        Parameters:
        k1 - the first mapping's key
        v1 - the first mapping's value
        k2 - the second mapping's key
        v2 - the second mapping's value
        k3 - the third mapping's key
        v3 - the third mapping's value
        k4 - the fourth mapping's key
        v4 - the fourth mapping's value
        k5 - the fifth mapping's key
        v5 - the fifth mapping's value
        k6 - the sixth mapping's key
        v6 - the sixth mapping's value
        k7 - the seventh mapping's key
        v7 - the seventh mapping's value
        k8 - the eighth mapping's key
        v8 - the eighth mapping's value
        k9 - the ninth mapping's key
        v9 - the ninth mapping's value
        k10 - the tenth mapping's key
        v10 - the tenth mapping's value
        Returns:
        a Map containing the specified mappings
        Throws:
        IllegalArgumentException - if any two keys are equal according to their natural ordering
        Since:
        31.0
      • copyOf

        public static <K,​V> ImmutableSortedMap<K,​V> copyOf​(Map<? extends K,​? extends V> map)
        Returns an immutable map containing the same entries as map, 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.

        Type Parameters:
        K - the Map's key type
        V - the Map's value type
        Parameters:
        map - a Map from which entries are drawn, must be non-null
        Returns:
        a Map containing the entries of the given Map
        Throws:
        ClassCastException - if the keys in map are not mutually comparable
        NullPointerException - if any key or value in map is null
        IllegalArgumentException - 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 as map, 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 in map is null
        IllegalArgumentException - if any two keys are equal according to the comparator
      • copyOf

        @Beta
        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 in map is null
        IllegalArgumentException - if any two keys are equal according to the comparator
        Since:
        19.0
      • copyOfSorted

        public 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.

        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 in map is null
      • size

        public int size()
        Description copied from interface: java.util.Map
        Returns the number of key-value mappings in this map. If the map contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.
        Specified by:
        size in interface Map<K,​V>
        Returns:
        the number of key-value mappings in this map
      • get

        @CheckForNull
        public V get​(@CheckForNull
                     Object key)
        Description copied from interface: java.util.Map
        Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

        More formally, if this map contains a mapping from a key k to a value v such that Objects.equals(key, k), then this method returns v; otherwise it returns null. (There can be at most one such mapping.)

        If this map permits null values, then a return value of null does not necessarily indicate that the map contains no mapping for the key; it's also possible that the map explicitly maps the key to null. The containsKey operation may be used to distinguish these two cases.

        Specified by:
        get in interface Map<K,​V>
        Specified by:
        get in class ImmutableMap<K,​V>
        Parameters:
        key - the key whose associated value is to be returned
        Returns:
        the value to which the specified key is mapped, or null if this map contains no mapping for the key
      • values

        public ImmutableCollection<Vvalues()
        Returns an immutable collection of the values in this map, sorted by the ordering of the corresponding keys.
        Specified by:
        values in interface Map<K,​V>
        Specified by:
        values in interface SortedMap<K,​V>
        Overrides:
        values in class ImmutableMap<K,​V>
        Returns:
        a collection view of the values contained in this map
      • comparator

        public Comparator<? super Kcomparator()
        Returns the comparator that orders the keys, which is Ordering.natural() when the natural ordering of the keys is used. Note that its behavior is not consistent with TreeMap.comparator(), which returns null to indicate natural ordering.
        Specified by:
        comparator in interface SortedMap<K,​V>
        Returns:
        the comparator used to order the keys in this map, or null if this map uses the natural ordering of its keys
      • firstKey

        public K firstKey()
        Description copied from interface: java.util.SortedMap
        Returns the first (lowest) key currently in this map.
        Specified by:
        firstKey in interface SortedMap<K,​V>
        Returns:
        the first (lowest) key currently in this map
      • lastKey

        public K lastKey()
        Description copied from interface: java.util.SortedMap
        Returns the last (highest) key currently in this map.
        Specified by:
        lastKey in interface SortedMap<K,​V>
        Returns:
        the last (highest) key currently in this map
      • headMap

        public ImmutableSortedMap<K,​VheadMap​(K toKey)
        This method returns a ImmutableSortedMap, consisting of the entries whose keys are less than toKey.

        The SortedMap.headMap(K) documentation states that a submap of a submap throws an IllegalArgumentException if passed a toKey greater than an earlier toKey. However, this method doesn't throw an exception in that situation, but instead keeps the original toKey.

        Specified by:
        headMap in interface NavigableMap<K,​V>
        Specified by:
        headMap in interface SortedMap<K,​V>
        Parameters:
        toKey - high endpoint (exclusive) of the keys in the returned map
        Returns:
        a view of the portion of this map whose keys are strictly less than toKey
      • headMap

        public ImmutableSortedMap<K,​VheadMap​(K toKey,
                                                     boolean inclusive)
        This method returns a ImmutableSortedMap, consisting of the entries whose keys are less than (or equal to, if inclusive) toKey.

        The SortedMap.headMap(K) documentation states that a submap of a submap throws an IllegalArgumentException if passed a toKey greater than an earlier toKey. However, this method doesn't throw an exception in that situation, but instead keeps the original toKey.

        Specified by:
        headMap in interface NavigableMap<K,​V>
        Parameters:
        toKey - high endpoint of the keys in the returned map
        inclusive - true if the high endpoint is to be included in the returned view
        Returns:
        a view of the portion of this map whose keys are less than (or equal to, if inclusive is true) toKey
        Since:
        12.0
      • subMap

        public ImmutableSortedMap<K,​VsubMap​(K fromKey,
                                                    K toKey)
        This method returns a ImmutableSortedMap, consisting of the entries whose keys ranges from fromKey, inclusive, to toKey, exclusive.

        The SortedMap.subMap(K, K) documentation states that a submap of a submap throws an IllegalArgumentException if passed a fromKey less than an earlier fromKey. However, this method doesn't throw an exception in that situation, but instead keeps the original fromKey. Similarly, this method keeps the original toKey, instead of throwing an exception, if passed a toKey greater than an earlier toKey.

        Specified by:
        subMap in interface NavigableMap<K,​V>
        Specified by:
        subMap in interface SortedMap<K,​V>
        Parameters:
        fromKey - low endpoint (inclusive) of the keys in the returned map
        toKey - high endpoint (exclusive) of the keys in the returned map
        Returns:
        a view of the portion of this map whose keys range from fromKey, inclusive, to toKey, exclusive
      • subMap

        public ImmutableSortedMap<K,​VsubMap​(K fromKey,
                                                    boolean fromInclusive,
                                                    K toKey,
                                                    boolean toInclusive)
        This method returns a ImmutableSortedMap, consisting of the entries whose keys ranges from fromKey to toKey, inclusive or exclusive as indicated by the boolean flags.

        The SortedMap.subMap(K, K) documentation states that a submap of a submap throws an IllegalArgumentException if passed a fromKey less than an earlier fromKey. However, this method doesn't throw an exception in that situation, but instead keeps the original fromKey. Similarly, this method keeps the original toKey, instead of throwing an exception, if passed a toKey greater than an earlier toKey.

        Specified by:
        subMap in interface NavigableMap<K,​V>
        Parameters:
        fromKey - low endpoint of the keys in the returned map
        fromInclusive - true if the low endpoint is to be included in the returned view
        toKey - high endpoint of the keys in the returned map
        toInclusive - true if the high endpoint is to be included in the returned view
        Returns:
        a view of the portion of this map whose keys range from fromKey to toKey
        Since:
        12.0
      • tailMap

        public ImmutableSortedMap<K,​VtailMap​(K fromKey)
        This method returns a ImmutableSortedMap, consisting of the entries whose keys are greater than or equals to fromKey.

        The SortedMap.tailMap(K) documentation states that a submap of a submap throws an IllegalArgumentException if passed a fromKey less than an earlier fromKey. However, this method doesn't throw an exception in that situation, but instead keeps the original fromKey.

        Specified by:
        tailMap in interface NavigableMap<K,​V>
        Specified by:
        tailMap in interface SortedMap<K,​V>
        Parameters:
        fromKey - low endpoint (inclusive) of the keys in the returned map
        Returns:
        a view of the portion of this map whose keys are greater than or equal to fromKey
      • tailMap

        public ImmutableSortedMap<K,​VtailMap​(K fromKey,
                                                     boolean inclusive)
        This method returns a ImmutableSortedMap, consisting of the entries whose keys are greater than (or equal to, if inclusive) fromKey.

        The SortedMap.tailMap(K) documentation states that a submap of a submap throws an IllegalArgumentException if passed a fromKey less than an earlier fromKey. However, this method doesn't throw an exception in that situation, but instead keeps the original fromKey.

        Specified by:
        tailMap in interface NavigableMap<K,​V>
        Parameters:
        fromKey - low endpoint of the keys in the returned map
        inclusive - true if the low endpoint is to be included in the returned view
        Returns:
        a view of the portion of this map whose keys are greater than (or equal to, if inclusive is true) fromKey
        Since:
        12.0
      • lowerEntry

        @CheckForNull
        public Map.Entry<K,​VlowerEntry​(K key)
        Description copied from interface: java.util.NavigableMap
        Returns a key-value mapping associated with the greatest key strictly less than the given key, or null if there is no such key.
        Specified by:
        lowerEntry in interface NavigableMap<K,​V>
        Parameters:
        key - the key
        Returns:
        an entry with the greatest key less than key, or null if there is no such key
      • lowerKey

        @CheckForNull
        public K lowerKey​(K key)
        Description copied from interface: java.util.NavigableMap
        Returns the greatest key strictly less than the given key, or null if there is no such key.
        Specified by:
        lowerKey in interface NavigableMap<K,​V>
        Parameters:
        key - the key
        Returns:
        the greatest key less than key, or null if there is no such key
      • floorEntry

        @CheckForNull
        public Map.Entry<K,​VfloorEntry​(K key)
        Description copied from interface: java.util.NavigableMap
        Returns a key-value mapping associated with the greatest key less than or equal to the given key, or null if there is no such key.
        Specified by:
        floorEntry in interface NavigableMap<K,​V>
        Parameters:
        key - the key
        Returns:
        an entry with the greatest key less than or equal to key, or null if there is no such key
      • floorKey

        @CheckForNull
        public K floorKey​(K key)
        Description copied from interface: java.util.NavigableMap
        Returns the greatest key less than or equal to the given key, or null if there is no such key.
        Specified by:
        floorKey in interface NavigableMap<K,​V>
        Parameters:
        key - the key
        Returns:
        the greatest key less than or equal to key, or null if there is no such key
      • ceilingEntry

        @CheckForNull
        public Map.Entry<K,​VceilingEntry​(K key)
        Description copied from interface: java.util.NavigableMap
        Returns a key-value mapping associated with the least key greater than or equal to the given key, or null if there is no such key.
        Specified by:
        ceilingEntry in interface NavigableMap<K,​V>
        Parameters:
        key - the key
        Returns:
        an entry with the least key greater than or equal to key, or null if there is no such key
      • ceilingKey

        @CheckForNull
        public K ceilingKey​(K key)
        Description copied from interface: java.util.NavigableMap
        Returns the least key greater than or equal to the given key, or null if there is no such key.
        Specified by:
        ceilingKey in interface NavigableMap<K,​V>
        Parameters:
        key - the key
        Returns:
        the least key greater than or equal to key, or null if there is no such key
      • higherEntry

        @CheckForNull
        public Map.Entry<K,​VhigherEntry​(K key)
        Description copied from interface: java.util.NavigableMap
        Returns a key-value mapping associated with the least key strictly greater than the given key, or null if there is no such key.
        Specified by:
        higherEntry in interface NavigableMap<K,​V>
        Parameters:
        key - the key
        Returns:
        an entry with the least key greater than key, or null if there is no such key
      • higherKey

        @CheckForNull
        public K higherKey​(K key)
        Description copied from interface: java.util.NavigableMap
        Returns the least key strictly greater than the given key, or null if there is no such key.
        Specified by:
        higherKey in interface NavigableMap<K,​V>
        Parameters:
        key - the key
        Returns:
        the least key greater than key, or null if there is no such key
      • descendingMap

        public ImmutableSortedMap<K,​VdescendingMap()
        Description copied from interface: java.util.NavigableMap
        Returns a reverse order view of the mappings contained in this map. The descending map is backed by this map, so changes to the map are reflected in the descending map, and vice-versa. If either map is modified while an iteration over a collection view of either map is in progress (except through the iterator's own remove operation), the results of the iteration are undefined.

        The returned map has an ordering equivalent to Collections.reverseOrder(comparator()). The expression m.descendingMap().descendingMap() returns a view of m essentially equivalent to m.

        Specified by:
        descendingMap in interface NavigableMap<K,​V>
        Returns:
        a reverse order view of this map
      • navigableKeySet

        public ImmutableSortedSet<KnavigableKeySet()
        Description copied from interface: java.util.NavigableMap
        Returns a NavigableSet view of the keys contained in this map. The set's iterator returns the keys in ascending order. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own remove operation), the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll, retainAll, and clear operations. It does not support the add or addAll operations.
        Specified by:
        navigableKeySet in interface NavigableMap<K,​V>
        Returns:
        a navigable set view of the keys in this map
      • descendingKeySet

        public ImmutableSortedSet<KdescendingKeySet()
        Description copied from interface: java.util.NavigableMap
        Returns a reverse order NavigableSet view of the keys contained in this map. The set's iterator returns the keys in descending order. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own remove operation), the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll, retainAll, and clear operations. It does not support the add or addAll operations.
        Specified by:
        descendingKeySet in interface NavigableMap<K,​V>
        Returns:
        a reverse order navigable set view of the keys in this map
      • of

        @Deprecated
        public static <K,​V> ImmutableSortedMap<K,​V> of​(K k1,
                                                                   V v1)
        Deprecated.
        Pass a key of type Comparable to use of(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 in ImmutableSortedMap, not this dummy version.
        Type Parameters:
        K - the Map's key type
        V - the Map's value type
        Parameters:
        k1 - the mapping's key
        v1 - the mapping's value
        Returns:
        a Map containing the specified mapping
        Throws:
        UnsupportedOperationException - always
      • of

        @Deprecated
        public static <K,​V> ImmutableSortedMap<K,​V> of​(K k1,
                                                                   V v1,
                                                                   K k2,
                                                                   V v2)
        Deprecated.
        Pass keys of type Comparable to use of(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 in ImmutableSortedMap, not this dummy version.
        Type Parameters:
        K - the Map's key type
        V - the Map's value type
        Parameters:
        k1 - the first mapping's key
        v1 - the first mapping's value
        k2 - the second mapping's key
        v2 - the second mapping's value
        Returns:
        a Map containing the specified mappings
        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)
        Deprecated.
        Not supported. You are attempting to create a map that may contain non-Comparable keys. Proper calls to will resolve to the version in ImmutableSortedMap, not this dummy version.
        Type Parameters:
        K - the Map's key type
        V - the Map's value type
        Parameters:
        k1 - the first mapping's key
        v1 - the first mapping's value
        k2 - the second mapping's key
        v2 - the second mapping's value
        k3 - the third mapping's key
        v3 - the third mapping's value
        Returns:
        a Map containing the specified mappings
        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)
        Not supported. You are attempting to create a map that may contain non-Comparable keys. Proper calls will resolve to the version in ImmutableSortedMap, not this dummy version.
        Type Parameters:
        K - the Map's key type
        V - the Map's value type
        Parameters:
        k1 - the first mapping's key
        v1 - the first mapping's value
        k2 - the second mapping's key
        v2 - the second mapping's value
        k3 - the third mapping's key
        v3 - the third mapping's value
        k4 - the fourth mapping's key
        v4 - the fourth mapping's value
        Returns:
        a Map containing the specified mappings
        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)
        Not supported. You are attempting to create a map that may contain non-Comparable keys. Proper calls will resolve to the version in ImmutableSortedMap, not this dummy version.
        Type Parameters:
        K - the Map's key type
        V - the Map's value type
        Parameters:
        k1 - the first mapping's key
        v1 - the first mapping's value
        k2 - the second mapping's key
        v2 - the second mapping's value
        k3 - the third mapping's key
        v3 - the third mapping's value
        k4 - the fourth mapping's key
        v4 - the fourth mapping's value
        k5 - the fifth mapping's key
        v5 - the fifth mapping's value
        Returns:
        a Map containing the specified mappings
        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)
        Not supported. You are attempting to create a map that may contain non-Comparable keys. Proper calls will resolve to the version in ImmutableSortedMap, not this dummy version.
        Type Parameters:
        K - the Map's key type
        V - the Map's value type
        Parameters:
        k1 - the first mapping's key
        v1 - the first mapping's value
        k2 - the second mapping's key
        v2 - the second mapping's value
        k3 - the third mapping's key
        v3 - the third mapping's value
        k4 - the fourth mapping's key
        v4 - the fourth mapping's value
        k5 - the fifth mapping's key
        v5 - the fifth mapping's value
        k6 - the sixth mapping's key
        v6 - the sixth mapping's value
        Returns:
        a Map containing the specified mappings
        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)
        Not supported. You are attempting to create a map that may contain non-Comparable keys. Proper calls will resolve to the version in ImmutableSortedMap, not this dummy version.
        Type Parameters:
        K - the Map's key type
        V - the Map's value type
        Parameters:
        k1 - the first mapping's key
        v1 - the first mapping's value
        k2 - the second mapping's key
        v2 - the second mapping's value
        k3 - the third mapping's key
        v3 - the third mapping's value
        k4 - the fourth mapping's key
        v4 - the fourth mapping's value
        k5 - the fifth mapping's key
        v5 - the fifth mapping's value
        k6 - the sixth mapping's key
        v6 - the sixth mapping's value
        k7 - the seventh mapping's key
        v7 - the seventh mapping's value
        Returns:
        a Map containing the specified mappings
        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)
        Not supported. You are attempting to create a map that may contain non-Comparable keys. Proper calls will resolve to the version in ImmutableSortedMap, not this dummy version.
        Type Parameters:
        K - the Map's key type
        V - the Map's value type
        Parameters:
        k1 - the first mapping's key
        v1 - the first mapping's value
        k2 - the second mapping's key
        v2 - the second mapping's value
        k3 - the third mapping's key
        v3 - the third mapping's value
        k4 - the fourth mapping's key
        v4 - the fourth mapping's value
        k5 - the fifth mapping's key
        v5 - the fifth mapping's value
        k6 - the sixth mapping's key
        v6 - the sixth mapping's value
        k7 - the seventh mapping's key
        v7 - the seventh mapping's value
        k8 - the eighth mapping's key
        v8 - the eighth mapping's value
        Returns:
        a Map containing the specified mappings
        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)
        Not supported. You are attempting to create a map that may contain non-Comparable keys. Proper calls will resolve to the version in ImmutableSortedMap, not this dummy version.
        Type Parameters:
        K - the Map's key type
        V - the Map's value type
        Parameters:
        k1 - the first mapping's key
        v1 - the first mapping's value
        k2 - the second mapping's key
        v2 - the second mapping's value
        k3 - the third mapping's key
        v3 - the third mapping's value
        k4 - the fourth mapping's key
        v4 - the fourth mapping's value
        k5 - the fifth mapping's key
        v5 - the fifth mapping's value
        k6 - the sixth mapping's key
        v6 - the sixth mapping's value
        k7 - the seventh mapping's key
        v7 - the seventh mapping's value
        k8 - the eighth mapping's key
        v8 - the eighth mapping's value
        k9 - the ninth mapping's key
        v9 - the ninth mapping's value
        Returns:
        a Map containing the specified mappings
        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)
        Not supported. You are attempting to create a map that may contain non-Comparable keys. Proper calls will resolve to the version in ImmutableSortedMap, not this dummy version.
        Type Parameters:
        K - the Map's key type
        V - the Map's value type
        Parameters:
        k1 - the first mapping's key
        v1 - the first mapping's value
        k2 - the second mapping's key
        v2 - the second mapping's value
        k3 - the third mapping's key
        v3 - the third mapping's value
        k4 - the fourth mapping's key
        v4 - the fourth mapping's value
        k5 - the fifth mapping's key
        v5 - the fifth mapping's value
        k6 - the sixth mapping's key
        v6 - the sixth mapping's value
        k7 - the seventh mapping's key
        v7 - the seventh mapping's value
        k8 - the eighth mapping's key
        v8 - the eighth mapping's value
        k9 - the ninth mapping's key
        v9 - the ninth mapping's value
        k10 - the tenth mapping's key
        v10 - the tenth mapping's value
        Returns:
        a Map containing the specified mappings
        Throws:
        UnsupportedOperationException - always
      • ofEntries

        @Deprecated
        public static <K,​V> ImmutableSortedMap<K,​V> ofEntries​(Map.Entry<? extends K,​? extends V>... entries)
        Deprecated.
        Use ImmutableSortedMap.copyOf(ImmutableMap.ofEntries(...)).
        Not supported. Use ImmutableSortedMap.copyOf(ImmutableMap.ofEntries(...)).
        Type Parameters:
        K - the Map's key type
        V - the Map's value type
        Parameters:
        entries - Map.Entrys containing the keys and values from which the map is populated
        Returns:
        a Map containing the specified mappings
        See Also:
        Map.entry()