it.unimi.dsi.fastutil.ints
Class AbstractIntBidirectionalIterator

java.lang.Object
  extended byit.unimi.dsi.fastutil.ints.AbstractIntIterator
      extended byit.unimi.dsi.fastutil.ints.AbstractIntBidirectionalIterator
All Implemented Interfaces:
BidirectionalIterator, IntBidirectionalIterator, IntIterator, Iterator
Direct Known Subclasses:
AbstractIntListIterator

public abstract class AbstractIntBidirectionalIterator
extends AbstractIntIterator
implements IntBidirectionalIterator

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

See Also:
Iterator

Method Summary
 int back(int n)
          This method just iterates previous() for at most n times, stopping if BidirectionalIterator.hasPrevious() becomes false.
 Object previous()
          This method just invokes the type-specific version.
 int previousInt()
          This method just invokes the generic version.
 
Methods inherited from class it.unimi.dsi.fastutil.ints.AbstractIntIterator
next, nextInt, 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.ints.IntIterator
nextInt, skip
 
Methods inherited from interface java.util.Iterator
hasNext, next, remove
 
Methods inherited from interface it.unimi.dsi.fastutil.BidirectionalIterator
hasPrevious
 

Method Detail

previousInt

public int previousInt()
This method just invokes the generic version.

Specified by:
previousInt in interface IntBidirectionalIterator
Returns:
the previous element from the collection.
See Also:
ListIterator.previous()

previous

public Object previous()
This method just invokes the type-specific version.

Specified by:
previous in interface BidirectionalIterator
Returns:
the previous element from the collection.
See Also:
ListIterator.previous()

back

public int back(int n)
This method just iterates previous() for at most n times, stopping if BidirectionalIterator.hasPrevious() becomes false.

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