Interface ReadOnlySortedMap<K,V>

Type Parameters:
K - the key type
V - the value type
All Superinterfaces:
Iterable<Map.Entry<K,V>>, ReadOnlyMap<K,V>, ReadOnlySequencedMap<K,V>
All Known Subinterfaces:
ImmutableNavigableMap<K,V>, ImmutableSortedMap<K,V>, ReadOnlyNavigableMap<K,V>
All Known Implementing Classes:
MutableRedBlackMap, ReadOnlyNavigableMapFacade, ReadOnlySortedMapFacade, RedBlackMap

public interface ReadOnlySortedMap<K,V> extends ReadOnlySequencedMap<K,V>
A read-only interface to a sorted map. A sorted map is a map that provides a total ordering on its keys.
  • Method Details

    • comparator

      @Nullable Comparator<? super K> comparator()
      Returns the comparator used to order the keys in this map, or null if this set uses the natural ordering of its keys.
      Returns:
      comparator or null
    • sortedMapEquals

      static <K, V> boolean sortedMapEquals(ReadOnlySortedMap<K,V> map, Object o)
      Compares a read-only map with an object for equality. Returns true if the given object is also a read-only map and the two maps represent the same entries.

      This operation is more efficient than ReadOnlyMap.mapEquals(ReadOnlyMap, Object).

      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      map - a map
      o - an object
      Returns:
      true if the object is equal to the map
    • spliterator

      default Spliterator<Map.Entry<K,V>> spliterator()
      Returns a spliterator over the entries contained in this map.
      Specified by:
      spliterator in interface Iterable<K>
      Specified by:
      spliterator in interface ReadOnlyMap<K,V>
      Returns:
      a spliterator
    • characteristics

      default int characteristics()
      Description copied from interface: ReadOnlySequencedMap
      Returns the spliterator characteristics of the key set. This implementation returns Spliterator.SIZED|Spliterator.DISTINCT.
      Specified by:
      characteristics in interface ReadOnlyMap<K,V>
      Specified by:
      characteristics in interface ReadOnlySequencedMap<K,V>
      Returns:
      characteristics.