Class ImmutableSortedMap<K,V>

java.lang.Object
java.util.AbstractMap<K,V>
com.landawn.abacus.util.ImmutableMap<K,V>
com.landawn.abacus.util.ImmutableSortedMap<K,V>
Type Parameters:
K - the key type
V - the value type
All Implemented Interfaces:
Immutable, Map<K,V>, SortedMap<K,V>
Direct Known Subclasses:
ImmutableNavigableMap

public class ImmutableSortedMap<K,V> extends ImmutableMap<K,V> implements SortedMap<K,V>
Since:
1.1.4
Author:
Haiyang Li
  • Method Details

    • empty

      public static <K, V> ImmutableSortedMap<K,V> empty()
      Type Parameters:
      K - the key type
      V - the value type
      Returns:
    • of

      public static <K extends Comparable<? super K>, V> ImmutableSortedMap<K,V> of(K k1, V v1)
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      k1 -
      v1 -
      Returns:
    • of

      public static <K extends Comparable<? super K>, V> ImmutableSortedMap<K,V> of(K k1, V v1, K k2, V v2)
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      k1 -
      v1 -
      k2 -
      v2 -
      Returns:
    • 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)
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      k1 -
      v1 -
      k2 -
      v2 -
      k3 -
      v3 -
      Returns:
    • 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)
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      k1 -
      v1 -
      k2 -
      v2 -
      k3 -
      v3 -
      k4 -
      v4 -
      Returns:
    • 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)
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      k1 -
      v1 -
      k2 -
      v2 -
      k3 -
      v3 -
      k4 -
      v4 -
      k5 -
      v5 -
      Returns:
    • 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)
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      k1 -
      v1 -
      k2 -
      v2 -
      k3 -
      v3 -
      k4 -
      v4 -
      k5 -
      v5 -
      k6 -
      v6 -
      Returns:
    • 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)
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      k1 -
      v1 -
      k2 -
      v2 -
      k3 -
      v3 -
      k4 -
      v4 -
      k5 -
      v5 -
      k6 -
      v6 -
      k7 -
      v7 -
      Returns:
    • copyOf

      public static <K, V> ImmutableSortedMap<K,V> copyOf(SortedMap<? extends K,? extends V> sortedMap)
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      sortedMap -
      Returns:
    • copyOf

      @Deprecated public static <K, V> ImmutableMap<K,V> copyOf(Map<? extends K,? extends V> map) throws UnsupportedOperationException
      Deprecated.
      throws UnsupportedOperationException
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      map -
      Returns:
      Throws:
      UnsupportedOperationException
    • wrap

      @Deprecated public static <K, V> ImmutableSortedMap<K,V> wrap(SortedMap<? extends K,? extends V> sortedMap)
      Deprecated.
      the ImmutableSortedMap may be modified through the specified sortedMap
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      sortedMap -
      Returns:
      an ImmutableSortedMap backed by the specified sortedMap
    • wrap

      @Deprecated public static <K, V> ImmutableMap<K,V> wrap(Map<? extends K,? extends V> map) throws UnsupportedOperationException
      Deprecated.
      throws UnsupportedOperationException
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      map -
      Returns:
      Throws:
      UnsupportedOperationException
    • comparator

      public Comparator<? super K> comparator()
      Specified by:
      comparator in interface SortedMap<K,V>
      Returns:
    • subMap

      public ImmutableSortedMap<K,V> subMap(K fromKey, K toKey)
      Specified by:
      subMap in interface SortedMap<K,V>
      Parameters:
      fromKey -
      toKey -
      Returns:
    • headMap

      public ImmutableSortedMap<K,V> headMap(K toKey)
      Specified by:
      headMap in interface SortedMap<K,V>
      Parameters:
      toKey -
      Returns:
    • tailMap

      public ImmutableSortedMap<K,V> tailMap(K fromKey)
      Specified by:
      tailMap in interface SortedMap<K,V>
      Parameters:
      fromKey -
      Returns:
    • firstKey

      public K firstKey()
      Specified by:
      firstKey in interface SortedMap<K,V>
      Returns:
    • lastKey

      public K lastKey()
      Specified by:
      lastKey in interface SortedMap<K,V>
      Returns: