Looks good. I've called similar methods assertIteratorExhausted instead of checkAtEnd. You could add
it.forEachRemaining(e -> throw new AssertionError()); to that method. On Tue, Dec 6, 2016 at 1:28 PM, Stuart Marks <stuart.ma...@oracle.com> wrote: > Hi all, > > Please review this small fix to adjust the behavior of > SingletonIterator.forEachRemaining in the case where its action throws an > exception: > > http://cr.openjdk.java.net/~smarks/reviews/8166446/webrev.0/ > > Strictly speaking, this behavior is undefined (see the spec adjustment > JDK-8168745 [1] [2] that Paul Sandoz pushed recently). However, we felt it > was reasonable to make this case behave consistently with the default > implementation of Iterator.forEachRemaining(), which advances before > calling the action. > > Also, please ignore the extra changeset comment lines in the webrev. > There's only one changeset here: > > rev 16204 : 8166446: SingletonIterator.forEachRemaining doesn't > advance before calling action > > Something funny is up with webrev.... > > Thanks, > > s'marks > > > [1] https://bugs.openjdk.java.net/browse/JDK-8168745 > > [2] http://hg.openjdk.java.net/jdk9/dev/jdk/rev/a563aaa85446 >