JEP 186: Collection Literals

Ali Lahijani alahijani at gmail.com
Fri Jan 31 04:11:26 PST 2014


Remi,

On Fri, Jan 31, 2014 at 12:13 PM, Remi Forax <forax at univ-mlv.fr> wrote:

> If one day the JDK has persistent collections (and I hope it will),
> there will be not interface to abstract them.
> (you can still ask all implementations in the javadoc of the interface
> to super swear that they are immutable but it's a weak contract).
>

If one day the JDK has persistent collections, dare we say that they should
be real values, instances of a value type? Because only in that case one
may hope for a language-enforced guarantee of immutability. The "legacy"
collection classes then may be retrofitted to become
privileged builder/buffer types for the new persistent collections;
somewhat similar to the relationship between Long and AtomicLong.

Admittedly I do not know how a variable-length value should look like. Just
guessing it would be of the same species as value-oriented immutable
arrays, provided the latter are ever seriously considered for inclusion in
the JDK.

Best,


More information about the lambda-dev mailing list