Java - APIs for Creating Unmodifiable Collections

Several new APIs have been added that facilitate the creation of unmodifiable collections.

  • The List.copyOf
  • Set.copyOf
  • Map.copyOf 

methods create new collection instances from existing instances.

New methods have been added to the Collectors class in the Stream package.

  • toUnmodifiableList
  • toUnmodifiableSet
  • toUnmodifiableMap  

These allow the elements of a Stream to be collected into an unmodifiable collection.

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Hibernate Search - Elasticsearch with JSON manipulation

Spring Elasticsearch Operations