T
- Type of object being iterated over.public class IterableIterator<T> extends Object implements Iterable<T>
Iterator
as an Iterable
so it can be used
in an a foreach loop. The iterator is consumed by the loop and so must only
be used once. Normal usage is as follows:
for (T t : IterableIterator.in(iterator)) { // ... }
Modifier and Type | Method and Description |
---|---|
static <T> Iterable<T> |
in(Iterator<T> iterator)
|
Iterator<T> |
iterator() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public static <T> Iterable<T> in(Iterator<T> iterator)
Iterator
as an Iterable
so it can be
used in a foreach loop. The iterator is consumed by the loop and so must
only be used once. Normal usage is as follows:
for (T t : IterableIterator.in(iterator)) { // ... }
T
- Type of object being iterated over.iterator
- an iterator