|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.jackrabbit.commons.iterator.RangeIteratorAdapter
public class RangeIteratorAdapter
Adapter for turning normal Iterators into RangeIterators.
This helper class is used by the adapter classes in this package to
implement the JCR iterator interfaces on top of normal Java iterators.
| Field Summary | |
|---|---|
static RangeIterator |
EMPTY
Static instance of an empty RangeIterator. |
| Constructor Summary | |
|---|---|
RangeIteratorAdapter(Collection collection)
Creates a RangeIterator for the given collection. |
|
RangeIteratorAdapter(Iterator iterator)
Creates an adapter for the given iterator of unknown size. |
|
RangeIteratorAdapter(Iterator iterator,
long size)
Creates an adapter for the given iterator of the given size. |
|
| Method Summary | |
|---|---|
long |
getPosition()
Returns the current position of the iterator. |
long |
getSize()
Returns the size of the iterator. |
boolean |
hasNext()
Checks if this iterator has more elements. |
Object |
next()
Returns the next element in this iterator and advances the iterator position. |
void |
remove()
Removes the previously retrieved element. |
void |
skip(long n)
Skips the given number of elements. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final RangeIterator EMPTY
RangeIterator.
| Constructor Detail |
|---|
public RangeIteratorAdapter(Iterator iterator,
long size)
iterator - adapted iteratorsize - size of the iterator, or -1 if unknownpublic RangeIteratorAdapter(Iterator iterator)
iterator - adapted iteratorpublic RangeIteratorAdapter(Collection collection)
RangeIterator for the given collection.
collection - the collection to iterate| Method Detail |
|---|
public long getPosition()
getPosition in interface RangeIteratorpublic long getSize()
getSize in interface RangeIterator
public void skip(long n)
throws IllegalArgumentException,
NoSuchElementException
skip in interface RangeIteratorn - number of elements to skip
IllegalArgumentException - if n is negative
NoSuchElementException - if skipped past the last elementpublic boolean hasNext()
hasNext in interface Iteratortrue if this iterator has more elements,
false otherwise
public Object next()
throws NoSuchElementException
next in interface IteratorNoSuchElementException - if there are no more elements
public void remove()
throws UnsupportedOperationException,
IllegalStateException
remove in interface IteratorUnsupportedOperationException - if removes are not permitted
IllegalStateException - if there is no previous element to remove
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||