Migrating methods in Collections
Brian Goetz
brian.goetz at oracle.com
Mon Dec 21 16:24:33 UTC 2015
> One would think that the boxing of T would be an implementation of
> Optional<T>, which would be incompatibly different as a signature.
Right, that's the thinking towards "migrate map()V to one or more other
method." The existing map() is irretrievably null-polluted; write some
new value-friendly methods. One of the forms uses Optional; this
assumes we can migrate Optional to be a value type in Valhalla
(requiring additional migration tools, along the lines alluded to when
you brought up collection index sizes.)
> Although I'm not exactly sure how this would work given the compromises
> defining Optional necessary to get it into jdk8.
Right. As a reference type, Optional is a box, and so while more
expressive than Integer, is no lighter. As a value type, different story.
More information about the valhalla-spec-experts
mailing list