Convenience factory methods for collections [JEP-269]
The Java programming language does not support collection literals. Adding this feature to the Java platform was proposed in 2013 and revisited in 2016, but it only gained exposure as a research proposal, not for future implementation.
Note
Oracle's definition of a collection literal is "a syntactic expression form that evaluates to an aggregate type, such as an array, list, or map" (http://openjdk.java.net/jeps/186).
Of course, that is until Java 9 is released. Implementing collection literals in the Java programming language is reported to have the following benefits:
- Performance improvement
- Increased safety
- Reduction of boilerplate code
Even without being part of the research group, our knowledge of the Java programming language clues us in to additional benefits:
- Ability to write shorter code
- Ability to write space-efficient code
- Ability to make collection literals immutable
Let's look at two cases--using collections before Java 9, and then...