T - StreamIterator<T>, Iterator<T>public class CountingStreamIterator<T> extends Object implements StreamIterator<T>
| Constructor | Description |
|---|---|
CountingStreamIterator(StreamIterator<T> origin) |
|
CountingStreamIterator(Iterator<T> origin) |
| Modifier and Type | Method | Description |
|---|---|---|
long |
getCount() |
Returns the count of the elements retrieved by
next() so far. |
boolean |
hasNext() |
|
T |
next() |
This method overwrites
Iterator.next() with a one change: The
resulting element is never null. |
static <V,I extends Iterator<V>> |
of(I streamIterator) |
This method
|
T |
peek() |
This method returns the next element which will be returned by next(),
without moving forward.
|
forEachRemaining, removeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitempty, filter, flatMap, map, spliterator, streampublic CountingStreamIterator(StreamIterator<T> origin)
public static <V,I extends Iterator<V>> CountingStreamIterator<V> of(I streamIterator)
streamIterator - public final long getCount()
next() so far.public final T next() throws NoSuchElementException
StreamIteratorIterator.next() with a one change: The
resulting element is never null.next in interface Iterator<T>next in interface StreamIterator<T>NoSuchElementException is thrown.
Iterator.hasNext() will returned false in this case and
should be asked for the presence of more elements in advance. The
result is never null.NoSuchElementException - is thrown in case the stream has reached its
end.public final T peek() throws NoSuchElementException
StreamIteratorpeek in interface StreamIterator<T>NoSuchElementException is thrown.
Iterator.hasNext() will returned false in this case and
should be asked for the presence of more elements in advance. The
result is never null.NoSuchElementException - is thrown in case the stream has reached its
end.Copyright © 2017–2018 PureSol Technologies. All rights reserved.