RFC: draft API for JEP 269 Convenience Collection Factories

Stephen Colebourne scolebourne at joda.org
Sat Oct 17 08:43:38 UTC 2015


On 14 October 2015 at 18:56, Kevin Bourrillion <kevinb at google.com> wrote:
> Note that we have empirically learned through our Lists/Sets/Maps factory
> classes that varargs factory methods for mutable collections are almost
> entirely useless.

Having taken a few days to think it over, I reluctantly think that
Kevin is right. Particularly as static methods on classes are
inherited, as Remi says. If someone needs a mutable one, they can
simply write:

new ArrayList<>(List.of(z, b, c))

Adding immutable implementations just on the interfaces seems like a
reasonable balancing point, and provides more API room to add the
IntFunction version I mentioned ;-)

As a side note, a really nice language change would be to deprecate
the ability to refer to static methods from subclasses or instance
variables in the JLS.

Stephen



More information about the core-libs-dev mailing list