RFR: 8267939: Clarify the specification of iterator and spliterator forEachRemaining

Paul Sandoz psandoz at openjdk.java.net
Wed Jun 2 22:03:47 UTC 2021


The specification of `forEachRemaining`, accepting a primitive functional interface, on the primitive iterators is updated to be the same as for `Iterator.forEachRemaining`, specifically the following is added:


     * <p>
     * Subsequent behavior of an iterator is unspecified if the action throws an
     * exception.


In addition the specification of `tryAdvance` and `forEachRemaining` on `Spliterator` and the primitive specializations are also updated to include a similar statement:


     * Subsequent behavior of a spliterator is unspecified if the action throws
     * an exception.

-------------

Commit messages:
 - 8267939: Clarifiy the specification of iterator and spliterator forEachRemaining

Changes: https://git.openjdk.java.net/jdk/pull/4290/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=4290&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8267939
  Stats: 48 lines in 2 files changed: 20 ins; 21 del; 7 mod
  Patch: https://git.openjdk.java.net/jdk/pull/4290.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/4290/head:pull/4290

PR: https://git.openjdk.java.net/jdk/pull/4290


More information about the core-libs-dev mailing list