RFC: draft API for JEP 269 Convenience Collection Factories

Remi Forax forax at univ-mlv.fr
Sat Oct 10 13:55:58 UTC 2015


----- Mail original -----
> De: "Stephen Colebourne" <scolebourne at joda.org>
> À: "core-libs-dev" <core-libs-dev at openjdk.java.net>
> Envoyé: Vendredi 9 Octobre 2015 15:11:47
> Objet: Re: RFC: draft API for JEP 269 Convenience Collection Factories
> 
> On 9 October 2015 at 00:39, Stuart Marks <stuart.marks at oracle.com> wrote:

[...]

> > 2. Other concrete collection factories.
> >
> > I've chosen to provide factories for the concrete collections ArrayList,
> > HashSet, and HashMap, since those seem to be the most commonly used. Is
> > there a need to provide factories for other concrete collections, such as
> > LinkedHashMap?
> 
> LinkedHashMap definitely
> LinkedList definitely not (as its very slow and use should not be
> encouraged).
> TreeSet/TreeMap, maybe, they'd need an extra parameter though.

There is an issue with LinkedHashMap (resp LinkedHashSet),
it inherits from HashMap /facepalm/, and static methods are accessible through class inheritance /facepalm/.
So if LinkedHashMap doesn't declare some methods of(),
  LinkedHashMap.of("foo")
will return a HashMap :(

cheers,
Rémi



More information about the core-libs-dev mailing list