Modifier and Type | Method and Description |
---|---|
E |
peek()
Returns the next element in the iteration without removing it from the
elements returned by
Iterator.next() . |
default E |
peekNonNull()
Returns the next element in the iteration without removing it from the
elements returned by
Iterator.next() . |
forEachRemaining, hasNext, next, remove
@Nullable E peek()
Iterator.next()
.
Use peekNonNull()
if the iterator is proven not to contain
null
.
NoSuchElementException
- if the iteration has no more
elementsdefault E peekNonNull()
Iterator.next()
.NoSuchElementException
- if the iteration has no more
elementsNullPointerException
- if the peeked element is
null
Copyright © 2025. All rights reserved.