Class FilteredRangeIterator
java.lang.Object
org.apache.jackrabbit.commons.iterator.FilteredRangeIterator
- All Implemented Interfaces:
Iterator,RangeIterator
Filtering decorator for iterators.
-
Constructor Summary
ConstructorsConstructorDescriptionFilteredRangeIterator(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. -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the zero-based position of the next element in this iterator.longgetSize()Returns the total number of elements in this iterator, or -1 if that number is unknown.booleanhasNext()Checks whether there are more elements in this iterator.next()Returns the next element in this iterator.voidremove()Not supported.voidskip(long n) Skips the next n elements.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
FilteredRangeIterator
Creates a new filtered iterator.- Parameters:
iterator- underlying iteratorpredicate-bufferSize-
-
FilteredRangeIterator
Creates a new filtered iterator with the default pre-fetch buffer size.- Parameters:
iterator- underlying iteratorpredicate- predicate used for filtering
-
FilteredRangeIterator
Creates a pre-fetching decorator for the given iterator. This constructor is mostly useful when it is desirable to use the pre-fetching feature to automatically- Parameters:
iterator- underlying iterator
-
-
Method Details
-
getPosition
public long getPosition()Returns the zero-based position of the next element in this iterator.- Specified by:
getPositionin interfaceRangeIterator- Returns:
- position of the next element
-
getSize
public long getSize()Returns the total number of elements in this iterator, or -1 if that number is unknown.- Specified by:
getSizein interfaceRangeIterator- Returns:
- number of elements in this iterator, or -1
-
skip
Skips the next n elements.- Specified by:
skipin interfaceRangeIterator- Parameters:
n- number of elements to skip- Throws:
IllegalArgumentException- if n is negativeNoSuchElementException- if there are not enough elements to skip
-
hasNext
public boolean hasNext()Checks whether there are more elements in this iterator. -
next
Returns the next element in this iterator.- Specified by:
nextin interfaceIterator- Returns:
- next element
- Throws:
NoSuchElementException- if there are no more elements
-
remove
Not supported.- Specified by:
removein interfaceIterator- Throws:
UnsupportedOperationException
-