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

Paul Sandoz paul.sandoz at oracle.com
Mon Nov 19 01:47:59 PST 2012


On Nov 18, 2012, at 9:28 PM, Brian Goetz <brian.goetz at Oracle.COM> 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.
> 
> A reasonable middle ground is a comodification check after the loop 
> terminates.
> 

Yes, that's what Mike did with the original array proxy stuff.

It's not a fail-fast solution thus risks "arbitrary, non-deterministic behavior at an undetermined time in the future", but i think it is within the scope of ConcurrentModificationException.

Paul.



More information about the lambda-dev mailing list