RFR(m): 8139233 add initial compact immutable collection implementations
Daniel Fuchs
daniel.fuchs at oracle.com
Wed May 4 10:08:13 UTC 2016
Hi Stuart,
It will be good to have really immutable collections!
But I have one comment:
I wonder about serial interoperability with earlier
versions of the JDK. For instance it will not be possible to
send a Set created with Set.of(...) in JDK 9 to a JDK 8 VM.
I wonder if there is any good solution to that.
You could of course use writeReplace() to return a plain
HashSet - but then you would only get a plain HashSet on
the other end. That might be fine if that other end
is JDK 8, but maybe not so good if it's actually JDK 9.
What worries me is that it will be very easy to forget about
the serial incompatibility, and start using these new factory
methods in e.g. java.lang.management, and then discover later
on that it has introduced an interoperability issue.
Is there any good way to prevent that - except thorough code
reviews?
best regards,
-- daniel
On 04/05/16 06:55, Stuart Marks wrote:
> Hi all,
>
> This is a reimplementation of collections created by the JEP 269
> convenience factory methods. These implementations are overall quite a
> bit smaller than their conventional collections counterparts,
> particularly at small sizes. Lookup performance for the hash-based
> structures (Set and Map) is not particularly fast, though in most cases
> it's comparable to TreeSet/TreeMap. Further improvements are likely
> possible.
>
> There are no API changes in this changeset.
>
> Please review:
>
> http://cr.openjdk.java.net/~smarks/reviews/8139233/webrev.0/
>
> JEP link:
>
> http://openjdk.java.net/jeps/269
>
> Thanks,
>
> s'marks
More information about the core-libs-dev
mailing list