RFR(m): 8139233u1 add initial compact immutable collection implementations
Remi Forax
forax at univ-mlv.fr
Mon May 9 19:17:05 UTC 2016
Hi Stephen,
you may right :)
First note that the Enum values are used as an ephemeral state, the serialized form still uses an integer as the original code.
You can also note that the enum is not loaded if no immutable collection is serialized (because CollSer is not initialized).
It's just a good old OOP trick that transforms a switch to a dispatch that will be used when de-serializing.
In my opinion, if there are several other immutable collections (like the ordered set/map proposed by Stuart), the code with an enum is easier to modify that the current code, otherwise, as you said, it's an overkill.
Rémi
----- Mail original -----
> De: "Stephen Colebourne" <scolebourne at joda.org>
> À: "core-libs-dev" <core-libs-dev at openjdk.java.net>
> Envoyé: Lundi 9 Mai 2016 19:49:15
> Objet: Re: RFR(m): 8139233u1 add initial compact immutable collection implementations
>
> On 9 May 2016 at 15:25, Remi Forax <forax at univ-mlv.fr> wrote:
> > CollSer implementation can be improved to avoid the ugly switch/case by
> > replacing the constant list by an enum,
>
> CollSer is modelled on JSR-310 code which uses an int. An enum would
> be a huge overkill for this use case.
>
> Stephen
>
More information about the core-libs-dev
mailing list