it.unimi.dsi.fastutil.booleans
Class AbstractBooleanBidirectionalIterator

java.lang.Object
  extended by it.unimi.dsi.fastutil.booleans.AbstractBooleanIterator
      extended by it.unimi.dsi.fastutil.booleans.AbstractBooleanBidirectionalIterator
All Implemented Interfaces:
BidirectionalIterator<Boolean>, BooleanBidirectionalIterator, BooleanIterator, ObjectBidirectionalIterator<Boolean>, ObjectIterator<Boolean>, Iterator<Boolean>
Direct Known Subclasses:
AbstractBooleanBigListIterator, AbstractBooleanListIterator, BooleanIterators.UnmodifiableBidirectionalIterator

public abstract class AbstractBooleanBidirectionalIterator
extends AbstractBooleanIterator
implements BooleanBidirectionalIterator

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.


Constructor Summary
protected AbstractBooleanBidirectionalIterator()
           
 
Method Summary
 int back(int n)
          This method just iterates the type-specific version of previous() for at most n times, stopping if BidirectionalIterator.hasPrevious() becomes false.
 Boolean previous()
          Delegates to the corresponding type-specific method.
 boolean previousBoolean()
          Delegates to the corresponding generic method.
 
Methods inherited from class it.unimi.dsi.fastutil.booleans.AbstractBooleanIterator
next, nextBoolean, remove, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface it.unimi.dsi.fastutil.booleans.BooleanIterator
nextBoolean, skip
 
Methods inherited from interface it.unimi.dsi.fastutil.objects.ObjectIterator
skip
 
Methods inherited from interface it.unimi.dsi.fastutil.BidirectionalIterator
hasPrevious
 
Methods inherited from interface java.util.Iterator
hasNext, next, remove
 

Constructor Detail

AbstractBooleanBidirectionalIterator

protected AbstractBooleanBidirectionalIterator()
Method Detail

previousBoolean

public boolean previousBoolean()
Delegates to the corresponding generic method.

Specified by:
previousBoolean in interface BooleanBidirectionalIterator
Returns:
the previous element in the iteration.
See Also:
ListIterator.previous()

previous

public Boolean previous()
Delegates to the corresponding type-specific method.

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

back

public int back(int n)
This method just iterates the type-specific version of previous() for at most n times, stopping if BidirectionalIterator.hasPrevious() becomes false.

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


Copyright © 2011. All Rights Reserved.