JEP 269: Convenience Factory Methods for Collections (original) (raw)

Stephen Colebourne scolebourne at joda.org
Wed Oct 7 09:30:27 UTC 2015


On 7 October 2015 at 01:13, Stuart Marks <stuart.marks at oracle.com> wrote:

My question is, is this enough of a problem that we should allow nulls in these collections? I would prefer not to do this, but if there is evidence that this would be a mistake, I'd like to hear it.

And if disallowing nulls will cause developers to create things like Map<K,Optional>, are we ok with that, and are developers ok with that?

Given what we know now vs when the collections library ws created, I think it would be a mistake to allow nulls. Developers that desperately want null in there have other mechanisms to achieve that, not just Optional. I too would argue against Optional in collections, at least until value types exist, but thats a social discussion, not one that can be controlled.

Stephen



More information about the core-libs-dev mailing list