please review draft JEP: Convenience Factory Methods for Collections
Michael Kay
mike at saxonica.com
Thu Jul 17 07:21:42 UTC 2014
Set.of() and List.of() look very attractive; Map.of() looks very ugly.
I would much prefer to write something like
Map.of(
Map.pair(key, value),
Map.pair(key, value),
Map.pair(key, value)
);
and have no limit on the number of pairs. (Don't care how it works internally...)
The last thing I want is to have to rewrite all my code when someone asks me to add a sixth entry to the map initialization!
Michael Kay
Saxonica
mike at saxonica.com
+44 (0118) 946 5893
On 17 Jul 2014, at 01:46, Stuart Marks <stuart.marks at oracle.com> wrote:
> Hi all,
>
> Please review this draft JEP for Convenience Factory Methods for Collections:
>
> https://bugs.openjdk.java.net/browse/JDK-8048330
>
> Brief background: several times over the years there have been proposals to add "collection literals" to the language. The most recent round of this was in regard to JEP 186, a research JEP to explore this topic. That effort was concluded by Brian Goetz, as summarized in this email:
>
> http://mail.openjdk.java.net/pipermail/lambda-dev/2014-March/011938.html
>
> Essentially, the idea of adding collection literals to the language was set aside in favor of adding some library APIs, not entirely unlike collection literals, that make it more convenient to create collections. That's what this proposal is.
>
> Share and enjoy,
>
> s'marks
>
More information about the core-libs-dev
mailing list