it.unimi.dsi.fastutil.objects
Class AbstractObjectBidirectionalIterator<K>

java.lang.Object
  extended by it.unimi.dsi.fastutil.objects.AbstractObjectIterator<K>
      extended by it.unimi.dsi.fastutil.objects.AbstractObjectBidirectionalIterator<K>
All Implemented Interfaces:
BidirectionalIterator<K>, ObjectBidirectionalIterator<K>, ObjectIterator<K>, Iterator<K>
Direct Known Subclasses:
AbstractObjectListIterator, ObjectIterators.UnmodifiableBidirectionalIterator

public abstract class AbstractObjectBidirectionalIterator<K>
extends AbstractObjectIterator<K>
implements ObjectBidirectionalIterator<K>

An abstract class facilitating the creation of type-specific bidirectional iterators.

To create a type-specific bidirectional iterator, besides what is needed for an iterator you need both a method returning the previous element as primitive type and a method returning the previous element as an object. However, if you inherit from this class you need just one (anyone).

This class implements also a trivial version of back(int) that uses type-specific methods.


Method Summary
 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.
 
Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractObjectIterator
remove, skip
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface it.unimi.dsi.fastutil.objects.ObjectIterator
skip
 
Methods inherited from interface java.util.Iterator
hasNext, next, remove
 
Methods inherited from interface it.unimi.dsi.fastutil.BidirectionalIterator
hasPrevious, previous
 
Methods inherited from interface java.util.Iterator
hasNext, next, remove
 

Method Detail

back

public 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.

Specified by:
back in interface ObjectBidirectionalIterator<K>
Parameters:
n - the number of elements to skip back.
Returns:
the number of elements actually skipped.
See Also:
Iterator.next()