RFR: 8005051: optimized defaults for Iterator.forEachRemaining (original) (raw)

Akhil Arora akhil.arora at oracle.com
Tue Apr 23 19🔞20 UTC 2013


On 04/22/2013 11:42 AM, Alan Bateman wrote:

On 20/04/2013 00:59, Akhil Arora wrote:

Please review the addition of optimized defaults for Iterator's forEachRemaining to ArrayList, LinkedList, Vector and CopyOnWriteArrayList. The unit test has a performance comparison test (disabled by default) that measures the difference between this method and hasNext()/next(). Significant improvements were measured by overriding the default forEachRemaining by these classes (others, not so much).

http://cr.openjdk.java.net/~akhil/8005051.1/webrev/ Thanks One thing I meant to ask when forEachRemaining was added was whether it should say anything about the "last element"? I see in the webrev that you've set it for the ArrayList iterators but not the LinkedList iterator - should it?

done, and added more tests for the state of the iterator after forEachRemaining returns

http://cr.openjdk.java.net/~akhil/8005051.2/webrev/

(a portion of version 1 of the webrev has already been pushed to TL as part of rev 6973 http://hg.openjdk.java.net/jdk8/tl/jdk/rev/98a7bb7baa76)



More information about the core-libs-dev mailing list