Methods
# forEachRemaining(action)
Performs the given action for each remaining element until all elements have been processed or the action throws an exception. Actions are performed in the order of iteration, if that order is specified. Exceptions thrown by the action are relayed to the caller. The behavior of an iterator is unspecified if the action modifies the collection in any way unless an overriding class has specified a concurrent modification policy Subsequent behavior of an iterator is unspecified if the action throws an exception.
Name | Type | Description |
---|---|---|
action |
The action to be performed for each element |
//The default implementation behaves as if:
while (hasNext())
action.accept(next());
# hasNext() → {true}
Returns {true} if the iteration has more elements. return an element rather than throwing an exception.)
if the iteration has more elements
- Type
- true
# next()
Returns the next element in the iteration.
the next element in the iteration
# remove()
Removes from the underlying collection the last element returned by this iterator (optional operation). 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, unless an overriding class has specified a concurrent modification policy.