T - the element's typeX - the type of the exception that may be thrownpublic interface ThrowingIterator<T,X extends Exception>
Iterator.Iterator| Modifier and Type | Method and Description |
|---|---|
default void |
forEachRemaining(ThrowingConsumer<? super T,? extends X> action)
Performs the given action for each remaining element until all elements have been processed or the action throws
an exception.
|
boolean |
hasNext()
Returns
true if the iteration has more elements. |
T |
next()
Returns the next element in the iteration.
|
default void |
remove()
Removes from the underlying collection the last element returned by this iterator (optional operation).
|
default void forEachRemaining(ThrowingConsumer<? super T,? extends X> action) throws X extends Exception
action - The action to be performed for each elementNullPointerException - if the specified action is nullX - if iteration failsX extends ExceptionIterator.forEachRemaining(java.util.function.Consumer)@CheckReturnValue T next() throws NoSuchElementException, X extends Exception
NoSuchElementException - if the iteration has no more elementsX - if the next element could not be acquiredX extends ExceptionIterator.next()@CheckReturnValue boolean hasNext() throws X extends Exception
true if the iteration has more elements. (In other words, returns true if next()
would return an element rather than throwing an exception.)true if the iteration has more elementsX - if the check for the next value failsX extends ExceptionIterator.hasNext()default void remove()
throws X extends Exception
next(). The behavior of an iterator is unspecified if the
underlying collection is modified while the iteration is in progress in any way other than by calling this
method.
The default implementation throws an instance of UnsupportedOperationException and performs no other
action.UnsupportedOperationException - if the remove operation is not supported by this iteratorIllegalStateException - if the next method has not yet been called, or the remove
method has already been called after the last call to the next
methodX - if the remove operations failsX extends ExceptionIterator.remove()Copyright © 2015–2020 52°North Initiative for Geospatial Open Source Software GmbH. All rights reserved.