Class ImmutableNavigableMap<K,V>

Type Parameters:
K - the key type
V - the value type
All Implemented Interfaces:
Immutable, Map<K,V>, NavigableMap<K,V>, SequencedMap<K,V>, SortedMap<K,V>

public class ImmutableNavigableMap<K,V> extends ImmutableSortedMap<K,V> implements NavigableMap<K,V>
  • Method Details

    • empty

      public static <K, V> ImmutableNavigableMap<K,V> empty()
      Returns an empty ImmutableNavigableMap.
      Type Parameters:
      K - the type of the keys in the ImmutableNavigableMap
      V - the type of the values in the ImmutableNavigableMap
      Returns:
      an empty ImmutableNavigableMap
    • of

      public static <K extends Comparable<? super K>, V> ImmutableNavigableMap<K,V> of(K k1, V v1)
      Returns an ImmutableNavigableMap containing the provided key-value pair.
      Type Parameters:
      K - the type of the key in the ImmutableNavigableMap
      V - the type of the value in the ImmutableNavigableMap
      Parameters:
      k1 - the key to be included in the ImmutableNavigableMap
      v1 - the value to be associated with the key
      Returns:
      an ImmutableNavigableMap containing the provided key-value pair
    • of

      public static <K extends Comparable<? super K>, V> ImmutableNavigableMap<K,V> of(K k1, V v1, K k2, V v2)
      Returns an ImmutableNavigableMap containing the provided key-value pairs.
      Type Parameters:
      K - the type of the keys in the ImmutableNavigableMap
      V - the type of the values in the ImmutableNavigableMap
      Parameters:
      k1 - the first key to be included in the ImmutableNavigableMap
      v1 - the value to be associated with the first key
      k2 - the second key to be included in the ImmutableNavigableMap
      v2 - the value to be associated with the second key
      Returns:
      an ImmutableNavigableMap containing the provided key-value pairs
    • of

      public static <K extends Comparable<? super K>, V> ImmutableNavigableMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3)
      Returns an ImmutableNavigableMap containing the provided key-value pairs.
      Type Parameters:
      K - the type of the keys in the ImmutableNavigableMap
      V - the type of the values in the ImmutableNavigableMap
      Parameters:
      k1 - the first key to be included in the ImmutableNavigableMap
      v1 - the value to be associated with the first key
      k2 - the second key to be included in the ImmutableNavigableMap
      v2 - the value to be associated with the second key
      k3 - the third key to be included in the ImmutableNavigableMap
      v3 - the value to be associated with the third key
      Returns:
      an ImmutableNavigableMap containing the provided key-value pairs
    • of

      public static <K extends Comparable<? super K>, V> ImmutableNavigableMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4)
      Returns an ImmutableNavigableMap containing the provided key-value pairs.
      Type Parameters:
      K - the type of the keys in the ImmutableNavigableMap
      V - the type of the values in the ImmutableNavigableMap
      Parameters:
      k1 - to k4 the keys to be included in the ImmutableNavigableMap
      v1 - to v4 the values to be associated with the keys
      Returns:
      an ImmutableSortedMap containing the provided key-value pairs
    • of

      public static <K extends Comparable<? super K>, V> ImmutableNavigableMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5)
      Returns an ImmutableNavigableMap containing the provided key-value pairs.
      Type Parameters:
      K - the type of the keys in the ImmutableNavigableMap
      V - the type of the values in the ImmutableNavigableMap
      Parameters:
      k1 - to k5 the keys to be included in the ImmutableNavigableMap
      v1 - to v5 the values to be associated with the keys
      Returns:
      an ImmutableSortedMap containing the provided key-value pairs
    • of

      public static <K extends Comparable<? super K>, V> ImmutableNavigableMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6)
      Returns an ImmutableNavigableMap containing the provided key-value pairs.
      Type Parameters:
      K - the type of the keys in the ImmutableNavigableMap
      V - the type of the values in the ImmutableNavigableMap
      Parameters:
      k1 - to k6 the keys to be included in the ImmutableNavigableMap
      v1 - to v6 the values to be associated with the keys
      Returns:
      an ImmutableSortedMap containing the provided key-value pairs
    • of

      public static <K extends Comparable<? super K>, V> ImmutableNavigableMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7)
      Returns an ImmutableNavigableMap containing the provided key-value pairs.
      Type Parameters:
      K - the type of the keys in the ImmutableNavigableMap
      V - the type of the values in the ImmutableNavigableMap
      Parameters:
      k1 - to k7 the keys to be included in the ImmutableNavigableMap
      v1 - to v7 the values to be associated with the keys
      Returns:
      an ImmutableSortedMap containing the provided key-value pairs
    • of

      public static <K extends Comparable<? super K>, V> ImmutableNavigableMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8)
      Returns an ImmutableNavigableMap containing the provided key-value pairs.
      Type Parameters:
      K - the type of the keys in the ImmutableNavigableMap
      V - the type of the values in the ImmutableNavigableMap
      Parameters:
      k1 - to k8 the keys to be included in the ImmutableNavigableMap
      v1 - to v8 the values to be associated with the keys
      Returns:
      an ImmutableSortedMap containing the provided key-value pairs
    • of

      public static <K extends Comparable<? super K>, V> ImmutableNavigableMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9)
      Returns an ImmutableNavigableMap containing the provided key-value pairs.
      Type Parameters:
      K - the type of the keys in the ImmutableNavigableMap
      V - the type of the values in the ImmutableNavigableMap
      Parameters:
      k1 - to k9 the keys to be included in the ImmutableNavigableMap
      v1 - to v9 the values to be associated with the keys
      Returns:
      an ImmutableSortedMap containing the provided key-value pairs
    • of

      public static <K extends Comparable<? super K>, V> ImmutableNavigableMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9, K k10, V v10)
      Returns an ImmutableNavigableMap containing the provided key-value pairs.
      Type Parameters:
      K - the type of the keys in the ImmutableNavigableMap
      V - the type of the values in the ImmutableNavigableMap
      Parameters:
      k1 - to k10 the keys to be included in the ImmutableNavigableMap
      v1 - to v10 the values to be associated with the keys
      Returns:
      an ImmutableSortedMap containing the provided key-value pairs
    • copyOf

      public static <K, V> ImmutableNavigableMap<K,V> copyOf(SortedMap<? extends K,? extends V> sortedMap)
      Returns an ImmutableNavigableMap containing the same mappings as the provided SortedMap. If the provided SortedMap is already an instance of ImmutableNavigableMap, it is directly returned. If the provided SortedMap is null or empty, an empty ImmutableNavigableMap is returned. Otherwise, a new ImmutableNavigableMap is created with the elements of the provided SortedMap.
      Type Parameters:
      K - the type of keys in the SortedMap
      V - the type of values in the SortedMap
      Parameters:
      sortedMap - the SortedMap whose mappings are to be placed in the ImmutableNavigableMap
      Returns:
      an ImmutableNavigableMap containing the same mappings as the provided SortedMap
    • wrap

      @Beta public static <K, V> ImmutableNavigableMap<K,V> wrap(NavigableMap<? extends K,? extends V> navigableMap)
      Returns an ImmutableNavigableMap that is backed by the provided NavigableMap. Changes to the specified NavigableMap will be reflected in the ImmutableNavigableMap. If the provided NavigableMap is already an instance of ImmutableNavigableMap, it is directly returned. If the NavigableMap is null, an empty ImmutableNavigableMap is returned. Otherwise, returns a new ImmutableNavigableMap backed by the provided NavigableMap.
      Type Parameters:
      K - the type of keys in the NavigableMap
      V - the type of values in the NavigableMap
      Parameters:
      navigableMap - the NavigableMap to be used as the base for the ImmutableNavigableMap
      Returns:
      an ImmutableNavigableMap that is backed by the provided NavigableMap
    • wrap

      @Deprecated public static <K, V> ImmutableSortedMap<K,V> wrap(SortedMap<? extends K,? extends V> sortedMap) throws UnsupportedOperationException
      Deprecated.
      throws UnsupportedOperationException
      This method is deprecated and will throw an UnsupportedOperationException if used.
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      sortedMap -
      Returns:
      Throws:
      UnsupportedOperationException
    • lowerEntry

      public ImmutableEntry<K,V> lowerEntry(K key)
      Specified by:
      lowerEntry in interface NavigableMap<K,V>
      Parameters:
      key -
      Returns:
    • lowerKey

      public K lowerKey(K key)
      Specified by:
      lowerKey in interface NavigableMap<K,V>
      Parameters:
      key -
      Returns:
    • floorEntry

      public ImmutableEntry<K,V> floorEntry(K key)
      Specified by:
      floorEntry in interface NavigableMap<K,V>
      Parameters:
      key -
      Returns:
    • floorKey

      public K floorKey(K key)
      Specified by:
      floorKey in interface NavigableMap<K,V>
      Parameters:
      key -
      Returns:
    • ceilingEntry

      public ImmutableEntry<K,V> ceilingEntry(K key)
      Specified by:
      ceilingEntry in interface NavigableMap<K,V>
      Parameters:
      key -
      Returns:
    • ceilingKey

      public K ceilingKey(K key)
      Specified by:
      ceilingKey in interface NavigableMap<K,V>
      Parameters:
      key -
      Returns:
    • higherEntry

      public ImmutableEntry<K,V> higherEntry(K key)
      Specified by:
      higherEntry in interface NavigableMap<K,V>
      Parameters:
      key -
      Returns:
    • higherKey

      public K higherKey(K key)
      Specified by:
      higherKey in interface NavigableMap<K,V>
      Parameters:
      key -
      Returns:
    • firstEntry

      public ImmutableEntry<K,V> firstEntry()
      Specified by:
      firstEntry in interface NavigableMap<K,V>
      Specified by:
      firstEntry in interface SequencedMap<K,V>
    • lastEntry

      public ImmutableEntry<K,V> lastEntry()
      Specified by:
      lastEntry in interface NavigableMap<K,V>
      Specified by:
      lastEntry in interface SequencedMap<K,V>
    • pollFirstEntry

      @Deprecated public Map.Entry<K,V> pollFirstEntry() throws UnsupportedOperationException
      Deprecated.
      throws UnsupportedOperationException
      Poll first entry.
      Specified by:
      pollFirstEntry in interface NavigableMap<K,V>
      Specified by:
      pollFirstEntry in interface SequencedMap<K,V>
      Returns:
      Throws:
      UnsupportedOperationException
    • pollLastEntry

      @Deprecated public Map.Entry<K,V> pollLastEntry() throws UnsupportedOperationException
      Deprecated.
      throws UnsupportedOperationException
      Poll last entry.
      Specified by:
      pollLastEntry in interface NavigableMap<K,V>
      Specified by:
      pollLastEntry in interface SequencedMap<K,V>
      Returns:
      Throws:
      UnsupportedOperationException
    • descendingMap

      public ImmutableNavigableMap<K,V> descendingMap()
      Specified by:
      descendingMap in interface NavigableMap<K,V>
    • descendingKeySet

      public ImmutableNavigableSet<K> descendingKeySet()
      Descending key set.
      Specified by:
      descendingKeySet in interface NavigableMap<K,V>
      Returns:
    • subMap

      public ImmutableNavigableMap<K,V> subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive)
      Specified by:
      subMap in interface NavigableMap<K,V>
      Parameters:
      fromKey -
      fromInclusive -
      toKey -
      toInclusive -
      Returns:
    • headMap

      public ImmutableNavigableMap<K,V> headMap(K toKey, boolean inclusive)
      Specified by:
      headMap in interface NavigableMap<K,V>
      Parameters:
      toKey -
      inclusive -
      Returns:
    • tailMap

      public ImmutableNavigableMap<K,V> tailMap(K fromKey, boolean inclusive)
      Specified by:
      tailMap in interface NavigableMap<K,V>
      Parameters:
      fromKey -
      inclusive -
      Returns: