ArrayFactory SAM type / toArray
aleksey.shipilev at oracle.com
Thu Sep 20 03:37:24 PDT 2012
On 09/20/2012 02:25 PM, Aleksey Shipilev wrote:
> This, by the way, makes me thinking: if ArrayFactory contract is relaxed
> to say "provides the candidate for storing the values", i.e. dropping
> the referential equality out of the question, we can then do pre-cached
> returns from toArray for small collections, and thus completely spare
> the allocations on some of the code paths.
Haven't been thinking it through. This opens up the question about array
immutability, and while generally possible in immutable collections,
there is still a loophole to change the values in that returned array.
Still, it can be a viable choice for returning empty array for empty
More information about the lambda-libs-spec-observers