Class ImmutableSortedMap<K,​V>

  • All Implemented Interfaces:
    Serializable, Map<K,​V>, NavigableMap<K,​V>, SortedMap<K,​V>

    public abstract class ImmutableSortedMap<K,​V>
    extends ImmutableMap<K,​V>
    implements NavigableMap<K,​V>
    An immutable SortedMap. Does not permit null keys or values.

    Unlike Collections.unmodifiableSortedMap(java.util.SortedMap<K, ? extends V>), which is a view of a separate map which can still change, an instance of ImmutableSortedMap contains its own data and will never change. ImmutableSortedMap is convenient for public static final maps ("constant maps") and also lets you easily make a "defensive copy" of a map provided to your class by a caller.

    Note: Although this class is not final, it cannot be subclassed as it has no public or protected constructors. Thus, instances of this class are guaranteed to be immutable.

    See the Guava User Guide article on immutable collections.

    2.0 (imported from Google Collections Library; implements NavigableMap since 12.0)
    See Also:
    Serialized Form