JEP 186: Collection Literals
richard.warburton at gmail.com
Tue Jan 14 15:02:06 PST 2014
The real question is "how far do we go." The original Coin proposal
> stopped at sets, lists, and maps (and had a different syntax for each.)
> But this seems kind of lame; why can't something that is List-like but
> not a java.util.List participate?
Is there any real reason to restrict the proposal to implementing any
specific interface? It seems preferable to able to specify some kind of
recipe or factory for building an arbitrary concrete type out of a
collection literal. This could then be associated with the class it
constructs through a mechanism such as a ClassValue.
The reason I request for going so general is that if you genuinely follow
something like DDD some domain classes also feel like collections. There
are also a whole bunch of third party collections libraries or libraries
that have collection-like functionality associated with them. It would be a
shame to privilege core library classes over third party ones in this
There is /definitely/ a large amount of support for collection literals in
the wider community. It's one of those conversations that crops up fairly
regularly in the "Why doesn't Java have $x?" category.
More information about the lambda-dev