public class IteratorCollection extends AbstractCollection
Collection
that lazily reads its elements from an
Iterator
.
In other words, you can call iterator()
as often as you want, but the
IteratorCollection
will iterate over its delegate only once.
Constructor and Description |
---|
IteratorCollection(Iterator iterator) |
Modifier and Type | Method and Description |
---|---|
Iterator |
iterator() |
int |
size() |
add, addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
equals, hashCode, parallelStream, removeIf, spliterator, stream
public IteratorCollection(Iterator iterator)
public Iterator iterator()
iterator
in interface Iterable
iterator
in interface Collection
iterator
in class AbstractCollection
public int size()
size
in interface Collection
size
in class AbstractCollection
Copyright © 2001–2016. All rights reserved.