T
- The element type of the iterator and the collectionpublic class IteratorCollection<T>
extends java.util.AbstractCollection<T>
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.
Modifier and Type | Field and Description |
---|---|
private java.util.List |
elements
Lazily-filled collection of the elements delivered by the delegate.
|
private java.util.Iterator<T> |
iterator
The delegate.
|
Constructor and Description |
---|
IteratorCollection(java.util.Iterator iterator) |
Modifier and Type | Method and Description |
---|---|
java.util.Iterator<T> |
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