E
- The generic type of the iterator.public final class SingleElementIterator<E> extends Object implements Iterator<E>, Iterable<E>
Iterator
that contains only a single element. The element can be reset such that the
iterator can be used multiple times. Initially, the iterator is empty until an element is set via
set(Object)
.Constructor and Description |
---|
SingleElementIterator() |
Modifier and Type | Method and Description |
---|---|
boolean |
hasNext() |
Iterator<E> |
iterator() |
E |
next() |
void |
remove() |
void |
set(E current)
Resets the element.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
forEach, spliterator
public void set(E current)
current
- The element to make available to the iterator.Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.