T - The element type of the iterator and the collectionIterable<T>, Collection<T>public class IteratorCollection<T> extends 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.
| Constructor | Description |
|---|---|
IteratorCollection(Iterator iterator) |
| Modifier and Type | Method | Description |
|---|---|---|
Iterator<T> |
iterator() |
|
int |
size() |
add, addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringequals, hashCode, parallelStream, removeIf, spliterator, streampublic IteratorCollection(Iterator iterator)
public Iterator<T> iterator()
iterator in interface Collection<T>iterator in interface Iterable<T>iterator in class AbstractCollection<T>public int size()
size in interface Collection<T>size in class AbstractCollection<T>Copyright © 2001–2019. All rights reserved.