Skip navigation links

Package java8.util

Provides some of the new java.util classes and implementations of static and default interface methods added in Java 8 and, in addition, the JEP 269: Convenience Factory Methods for Collections that were introduced in Java 9.

See: Description

Package java8.util Description

Provides some of the new java.util classes and implementations of static and default interface methods added in Java 8 and, in addition, the JEP 269: Convenience Factory Methods for Collections that were introduced in Java 9.

Unmodifiable collections

An unmodifiable collection is a collection, all of whose mutator methods are specified to throw UnsupportedOperationException. Such a collection thus cannot be modified by calling any methods on it. For a collection to be properly unmodifiable, any view collections derived from it must also be unmodifiable. For example, if a List is unmodifiable, the List returned by List.subList is also unmodifiable.

An unmodifiable collection is not necessarily immutable. If the contained elements are mutable, the entire collection is clearly mutable, even though it might be unmodifiable. For example, consider two unmodifiable lists containing mutable elements. The result of calling list1.equals(list2) might differ from one call to the next if the elements had been mutated, even though both lists are unmodifiable. However, if an unmodifiable collection contains all immutable elements, it can be considered effectively immutable.

Since:
1.8
Skip navigation links

Copyright © 2021. All rights reserved.