public class FilteredRangeIterator extends Object implements RangeIterator
| Constructor and Description |
|---|
FilteredRangeIterator(Iterator<?> iterator)
Creates a pre-fetching decorator for the given iterator.
|
FilteredRangeIterator(Iterator<?> iterator,
Predicate predicate)
Creates a new filtered iterator with the default pre-fetch buffer size.
|
FilteredRangeIterator(Iterator<?> iterator,
Predicate predicate,
int bufferSize)
Creates a new filtered iterator.
|
| Modifier and Type | Method and Description |
|---|---|
long |
getPosition()
Returns the zero-based position of the next element in this iterator.
|
long |
getSize()
Returns the total number of elements in this iterator, or -1 if that
number is unknown.
|
boolean |
hasNext()
Checks whether there are more elements in this iterator.
|
Object |
next()
Returns the next element in this iterator.
|
void |
remove()
Not supported.
|
void |
skip(long n)
Skips the next n elements.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemainingpublic FilteredRangeIterator(Iterator<?> iterator, Predicate predicate, int bufferSize)
iterator - underlying iteratorpredicate - bufferSize - public FilteredRangeIterator(Iterator<?> iterator, Predicate predicate)
iterator - underlying iteratorpredicate - predicate used for filteringpublic FilteredRangeIterator(Iterator<?> iterator)
iterator - underlying iteratorpublic long getPosition()
getPosition in interface RangeIteratorpublic long getSize()
getSize in interface RangeIteratorpublic void skip(long n)
throws IllegalArgumentException,
NoSuchElementException
skip in interface RangeIteratorn - number of elements to skipIllegalArgumentException - if n is negativeNoSuchElementException - if there are not enough elements to skippublic boolean hasNext()
public Object next() throws NoSuchElementException
next in interface IteratorNoSuchElementException - if there are no more elementspublic void remove()
throws UnsupportedOperationException
remove in interface IteratorUnsupportedOperationExceptionCopyright © 2004–2021 The Apache Software Foundation. All rights reserved.