RFR: 8005051: optimized defaults for Iterator.forEachRemaining

Alan Bateman Alan.Bateman at oracle.com
Wed Apr 24 17:58:07 UTC 2013


On 24/04/2013 18:24, Akhil Arora wrote:
>
> Good question. forEachRemaining docs state -
>
> Implementation Requirements:
>
>     The default implementation behaves as if:
>
>     while (hasNext())
>              action.accept(next());
>
> so a subsequent remove() should remove the last element.
That specifies how the default implementation behaves rather than the 
general contract so I think it would be good to re-look at when there is 
time.

-Alan



More information about the core-libs-dev mailing list