public class FilteredRangeIterator extends java.lang.Object implements RangeIterator
Constructor and Description |
---|
FilteredRangeIterator(java.util.Iterator<?> iterator)
Creates a pre-fetching decorator for the given iterator.
|
FilteredRangeIterator(java.util.Iterator<?> iterator,
Predicate predicate)
Creates a new filtered iterator with the default pre-fetch buffer size.
|
FilteredRangeIterator(java.util.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.
|
java.lang.Object |
next()
Returns the next element in this iterator.
|
void |
remove()
Not supported.
|
void |
skip(long n)
Skips the next n elements.
|
public FilteredRangeIterator(java.util.Iterator<?> iterator, Predicate predicate, int bufferSize)
iterator
- underlying iteratorpredicate
- bufferSize
- public FilteredRangeIterator(java.util.Iterator<?> iterator, Predicate predicate)
iterator
- underlying iteratorpredicate
- predicate used for filteringpublic FilteredRangeIterator(java.util.Iterator<?> iterator)
iterator
- underlying iteratorpublic long getPosition()
getPosition
in interface RangeIterator
public long getSize()
getSize
in interface RangeIterator
public void skip(long n) throws java.lang.IllegalArgumentException, java.util.NoSuchElementException
skip
in interface RangeIterator
n
- number of elements to skipjava.lang.IllegalArgumentException
- if n is negativejava.util.NoSuchElementException
- if there are not enough elements to skippublic boolean hasNext()
hasNext
in interface java.util.Iterator
true
if there are more elements,
false
otherwisepublic java.lang.Object next() throws java.util.NoSuchElementException
next
in interface java.util.Iterator
java.util.NoSuchElementException
- if there are no more elementspublic void remove() throws java.lang.UnsupportedOperationException
remove
in interface java.util.Iterator
java.lang.UnsupportedOperationException
Copyright © 2010 - 2020 Adobe. All Rights Reserved