Proposal: Collection Literals

Kris Nuttycombe kris.nuttycombe at
Tue Mar 31 07:56:01 PDT 2009

Given the possibility of confusion between set literals and array
initializers, how much worse would it be simply to provide vararg
constructors, in the various collection classes? Similarly, why not
just some additional vararg factory methods in Collections that can be
used to produce the immutable versions?

I realize that the syntax isn't quite as terse as what this proposal
suggests, but I think it avoids the issues with reified types and
would not represent a substantial deviation from the current state of
the libraries.

The only place where this wouldn't work is for map literals; however,
if a Pair literal were introduced as has been suggested elsewhere then
this problem could be easily resolved.


More information about the coin-dev mailing list