8267939: Clarify the specification of iterator and spliterator forEachRemaining

Reviewed-by: smarks
This commit is contained in:
Paul Sandoz 2021-06-03 22:03:35 +00:00
parent 460ce5553c
commit c1f3094f81
2 changed files with 27 additions and 28 deletions

View file

@ -300,6 +300,9 @@ public interface Spliterator<T> {
* Spliterator is {@link #ORDERED} the action is performed on the
* next element in encounter order. Exceptions thrown by the
* action are relayed to the caller.
* <p>
* Subsequent behavior of a spliterator is unspecified if the action throws
* an exception.
*
* @param action The action
* @return {@code false} if no remaining elements existed
@ -314,6 +317,9 @@ public interface Spliterator<T> {
* throws an exception. If this Spliterator is {@link #ORDERED}, actions
* are performed in encounter order. Exceptions thrown by the action
* are relayed to the caller.
* <p>
* Subsequent behavior of a spliterator is unspecified if the action throws
* an exception.
*
* @implSpec
* The default implementation repeatedly invokes {@link #tryAdvance} until
@ -613,6 +619,9 @@ public interface Spliterator<T> {
* Spliterator is {@link #ORDERED} the action is performed on the
* next element in encounter order. Exceptions thrown by the
* action are relayed to the caller.
* <p>
* Subsequent behavior of a spliterator is unspecified if the action throws
* an exception.
*
* @param action The action
* @return {@code false} if no remaining elements existed
@ -628,6 +637,9 @@ public interface Spliterator<T> {
* action throws an exception. If this Spliterator is {@link #ORDERED},
* actions are performed in encounter order. Exceptions thrown by the
* action are relayed to the caller.
* <p>
* Subsequent behavior of a spliterator is unspecified if the action throws
* an exception.
*
* @implSpec
* The default implementation repeatedly invokes {@link #tryAdvance}