public static class ObjectIterators.EmptyIterator<K> extends AbstractObjectListIterator<K> implements java.io.Serializable, java.lang.Cloneable
This class may be useful to implement your own in case you subclass a type-specific iterator.
Modifier and Type | Method and Description |
---|---|
int |
back(int n)
This method just iterates the type-specific version of
BidirectionalIterator.previous() for
at most n times, stopping if BidirectionalIterator.hasPrevious() becomes false. |
java.lang.Object |
clone() |
boolean |
hasNext() |
boolean |
hasPrevious()
Returns whether there is a previous element.
|
K |
next() |
int |
nextIndex() |
K |
previous()
Returns the previous element from the collection.
|
int |
previousIndex() |
int |
skip(int n)
This method just iterates the type-specific version of
Iterator.next() for at most
n times, stopping if Iterator.hasNext() becomes false. |
add, set
remove
public boolean hasNext()
public boolean hasPrevious()
BidirectionalIterator
hasPrevious
in interface BidirectionalIterator<K>
hasPrevious
in interface java.util.ListIterator<K>
ListIterator.hasPrevious()
public K next()
public K previous()
BidirectionalIterator
previous
in interface BidirectionalIterator<K>
previous
in interface java.util.ListIterator<K>
ListIterator.previous()
public int nextIndex()
nextIndex
in interface java.util.ListIterator<K>
public int previousIndex()
previousIndex
in interface java.util.ListIterator<K>
public int skip(int n)
AbstractObjectIterator
Iterator.next()
for at most
n
times, stopping if Iterator.hasNext()
becomes false.skip
in interface ObjectIterator<K>
skip
in class AbstractObjectIterator<K>
n
- the number of elements to skip.Iterator.next()
public int back(int n)
AbstractObjectBidirectionalIterator
BidirectionalIterator.previous()
for
at most n
times, stopping if BidirectionalIterator.hasPrevious()
becomes false.back
in interface ObjectBidirectionalIterator<K>
back
in class AbstractObjectBidirectionalIterator<K>
n
- the number of elements to skip back.Iterator.next()
public java.lang.Object clone()
clone
in class java.lang.Object