public class FilteredRangeIterator extends Object
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.
|
public 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()
public long getSize()
public void skip(long n) throws IllegalArgumentException, NoSuchElementException
n
- number of elements to skipIllegalArgumentException
- if n is negativeNoSuchElementException
- if there are not enough elements to skippublic boolean hasNext()
true
if there are more elements,
false
otherwisepublic Object next() throws NoSuchElementException
NoSuchElementException
- if there are no more elementspublic void remove() throws UnsupportedOperationException
UnsupportedOperationException
"Copyright © 2006 - 2015 Adobe Systems Incorporated. All Rights Reserved"