hg: lambda/lambda/jdk: Streams cleanups; add optimized forEach implementations; include subList in tested lists

Remi Forax forax at univ-mlv.fr
Sun Nov 18 13:00:22 PST 2012


On 11/18/2012 09:28 PM, Brian Goetz wrote:
>> A code like this should throw a CME and not an AIOOBE
>> arraylist.forEach(e -> { arraylist.remove(e); })
>
> The current code won't do that, as it copies the array into a local 
> var before the loop, so the indexes are always valid.

the index may be valid but not the content of the array.

>
> A reasonable middle ground is a comodification check after the loop 
> terminates.
>

Rémi



More information about the lambda-dev mailing list