RFR(m): 8177290 add copy factory methods for unmodifiable List, Set, Map

Stuart Marks stuart.marks at oracle.com
Thu Sep 21 00:02:56 UTC 2017


(also includes 8184690: add Collectors for collecting into unmodifiable List, 
Set, and Map)

Hi all,

Please review the following changeset with specification changes to support the 
following:

* new List.copyOf(), Set.copyOf(), and Map.copyOf() "copy factory" methods

* new Collectors.toUnmodifiableList, Set, and Map methods

* specification revisions to provide clearer definitions of "view" collections, 
"unmodifiable" collections, and "unmodifiable views"

The specification text has walked back most uses of "immutable", changing many 
occurrences to "unmodifiable". (People thought that putting a mutable object 
into an immutable collection would somehow magically make the whole thing 
immutable. Also, there was continual confusion with "immutable persistent" data 
structures.)

This review is mainly about specification. Minimal implementations are included, 
but no tests. Those will come later.

Webrev:

     http://cr.openjdk.java.net/~smarks/reviews/8177290/webrev.0/

Bugs:

     https://bugs.openjdk.java.net/browse/JDK-8177290
         add copy factory methods for unmodifiable List, Set, Map

     https://bugs.openjdk.java.net/browse/JDK-8184690
         add Collectors for collecting into unmodifiable List, Set, and Map

Thanks,

s'marks


More information about the core-libs-dev mailing list