public class RangeIteratorAdapter
extends java.lang.Object
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()
public long getSize()
public void skip(long n)
throws java.lang.IllegalArgumentException,
java.util.NoSuchElementException
n - number of elements to skipjava.lang.IllegalArgumentException - if n is negativejava.util.NoSuchElementException - if skipped past the last elementpublic boolean hasNext()
true if this iterator has more elements,
false otherwisepublic java.lang.Object next()
throws java.util.NoSuchElementException
java.util.NoSuchElementException - if there are no more elementspublic void remove()
throws java.lang.UnsupportedOperationException,
java.lang.IllegalStateException
java.lang.UnsupportedOperationException - if removes are not permittedjava.lang.IllegalStateException - if there is no previous element to remove"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"