JDK-8026106 : Add static convenience methods on List/Set/Map
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.util:collections
  • Affected Version: 8
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2013-10-09
  • Updated: 2015-10-09
  • Resolved: 2015-10-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbd_majorResolved
Related Reports
Duplicate :  
Description
Per Stephen Colebourne: (http://mail.openjdk.java.net/pipermail/core-libs-dev/2013-June/018423.html)

One point lambdaification that I haven't seen mentioned is addition
static factory methods for the main collection interfaces. (Strictly,
this proposal is not point lambdaification as it does not involve
lambdas, but it is very much in the same area).

I propose adding these static methods:
Collection.empty()
Collection.of(T...)
List.empty()
List.of(T...)
Set.empty()
Set.of(T...)
Map.empty()
Map.of(Entry...)
Map.Entry.of(K, V)

Each of these methods would return immutable implementations.
There is a case for extending the methods to Iterator and other
collection types, however these are the most important.
These follow the designs of Stream static methods IIRC.

This library change would remove much of the requirement for the
"collection literals" change discussed in Project Coin.

Implementation would ideally be via new dedicated immutable classes,
however space could be saved by simply reusing the existing classes.

Is this something we could fit in? (Is resourcing the problem, or the idea?)

thanks
Stephen

Comments
This isn't really a subtask of JEP 269 (JDK-8048330). I've converted this back to being an Enhancement request, and I'm closing it as a dupe of JEP 269 since all of the development activities are centered around the JEP now.
09-10-2015

See http://mail.openjdk.java.net/pipermail/core-libs-dev/2013-September/021284.html for sample implementations
09-10-2013