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

Alan Bateman Alan.Bateman at oracle.com
Mon Apr 22 18:42:12 UTC 2013


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?

-Alan.



More information about the core-libs-dev mailing list