public class RangeIteratorAdapter extends java.lang.Object implements RangeIterator
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.| Modifier and Type | Field and Description |
|---|---|
static RangeIterator |
EMPTY
Static instance of an empty
RangeIterator. |
| Constructor and Description |
|---|
RangeIteratorAdapter(java.util.Collection collection)
Creates a
RangeIterator for the given collection. |
RangeIteratorAdapter(java.util.Iterator iterator)
Creates an adapter for the given iterator of unknown size.
|
RangeIteratorAdapter(java.util.Iterator iterator,
long size)
Creates an adapter for the given iterator of the given size.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
java.lang.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.
|
public static final RangeIterator EMPTY
RangeIterator.public RangeIteratorAdapter(java.util.Iterator iterator,
long size)
iterator - adapted iteratorsize - size of the iterator, or -1 if unknownpublic RangeIteratorAdapter(java.util.Iterator iterator)
iterator - adapted iteratorpublic RangeIteratorAdapter(java.util.Collection collection)
RangeIterator for the given collection.collection - the collection to iteratepublic long getPosition()
getPosition in interface RangeIteratorpublic long getSize()
getSize in interface RangeIteratorpublic void skip(long n)
throws java.lang.IllegalArgumentException,
java.util.NoSuchElementException
skip in interface RangeIteratorn - number of elements to skipjava.lang.IllegalArgumentException - if n is negativejava.util.NoSuchElementException - if skipped past the last elementpublic boolean hasNext()
hasNext in interface java.util.Iteratortrue if this iterator has more elements,
false otherwisepublic java.lang.Object next()
throws java.util.NoSuchElementException
next in interface java.util.Iteratorjava.util.NoSuchElementException - if there are no more elementspublic void remove()
throws java.lang.UnsupportedOperationException,
java.lang.IllegalStateException
remove in interface java.util.Iteratorjava.lang.UnsupportedOperationException - if removes are not permittedjava.lang.IllegalStateException - if there is no previous element to removeCopyright © 2010 - 2023 Adobe. All Rights Reserved