Class BoundedIterator<T>
java.lang.Object
org.apache.jackrabbit.spi.commons.iterator.BoundedIterator<T>
- Type Parameters:
T- element type
- All Implemented Interfaces:
Iterator<T>
Implements a bounded iterator which only returns a maximum number of element from an underlying iterator
starting at a given offset.
-
Constructor Summary
ConstructorsConstructorDescriptionBoundedIterator(long offset, long max, Iterator<T> iterator) Create a new bounded iterator with a given offset and maximum -
Method Summary
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
-
BoundedIterator
Create a new bounded iterator with a given offset and maximum- Parameters:
offset- offset to start iteration at. Must be non negativemax- maximum elements this iterator should return. Set to -1 for alliterator- the underlying iterator- Throws:
IllegalArgumentException- if offset is negative
-
-
Method Details
-
create
Factory for creating a bounded iterator.- Type Parameters:
T- element type- Parameters:
offset- offset to start iteration at. Must be non negativemax- maximum elements this iterator should return. Set to -1 for alliterator- the underlying iterator- Returns:
- an iterator which only returns the elements in the given bounds
- See Also:
-
hasNext
public boolean hasNext() -
next
-
remove
public void remove()
-