T - the type of elements iterated by the iteratorpublic class SnapshotIterator<T> extends Object implements ResettableIterator<T>, Serializable
SnapshotIterator class provides support for creating a
snapshot from another iterator; preserving the order of returned elements.
Note: An instance of this class can be properly serialized even if
the iterator object passed to its constructor is not serializable as long
as its elements are serializable. If the elements are of type
Map.Entry, then they will be cloned and made serializable
as long as the associated keys and values are serializable.
The implementation provided here takes a snapshot of all elements returned by the given iterator by iterating them and then releasing the iterator.
| Constructor and Description |
|---|
SnapshotIterator(Iterable<T> i)
Instantiates a new
SnapshotIterator object. |
SnapshotIterator(Iterator<T> i)
Instantiates a new
SnapshotIterator object. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
hasNext() |
T |
next() |
void |
remove() |
void |
reset() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemainingpublic SnapshotIterator(Iterator<T> i)
SnapshotIterator object.i - the iterator to create a snapshot forNullPointerException - if i is nullpublic SnapshotIterator(Iterable<T> i)
SnapshotIterator object.i - the iterable object to snapshot it's iteratorNullPointerException - if i is nullpublic void reset()
reset in interface ResettableIterator<T>ResettableIterator.reset()public boolean hasNext()
hasNext in interface Iterator<T>Iterator.hasNext()public T next()
next in interface Iterator<T>Iterator.next()public void remove()
remove in interface Iterator<T>UnsupportedOperationException - always thrownIterator.remove()Copyright (C) 2015-2015 The Helenus Driver Project Authors.