it.unimi.dsi.fastutil.booleans
Class AbstractBooleanIterator

java.lang.Object
  extended by it.unimi.dsi.fastutil.booleans.AbstractBooleanIterator
All Implemented Interfaces:
BooleanIterator, Iterator<Boolean>
Direct Known Subclasses:
AbstractBooleanBidirectionalIterator, AbstractByte2BooleanSortedMap.ValuesIterator, AbstractChar2BooleanSortedMap.ValuesIterator, AbstractDouble2BooleanSortedMap.ValuesIterator, AbstractFloat2BooleanSortedMap.ValuesIterator, AbstractInt2BooleanSortedMap.ValuesIterator, AbstractLong2BooleanSortedMap.ValuesIterator, AbstractObject2BooleanSortedMap.ValuesIterator, AbstractReference2BooleanSortedMap.ValuesIterator, AbstractShort2BooleanSortedMap.ValuesIterator, BooleanIterators.UnmodifiableIterator

public abstract class AbstractBooleanIterator
extends Object
implements BooleanIterator

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

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

This class implements also a trivial version of skip(int) that uses type-specific methods; moreover, remove() will throw an UnsupportedOperationException.

See Also:
Iterator

Constructor Summary
protected AbstractBooleanIterator()
           
 
Method Summary
 Boolean next()
          Delegates to the corresponding type-specific method.
 boolean nextBoolean()
          Delegates to the corresponding generic method.
 void remove()
          This method just throws an UnsupportedOperationException.
 int skip(int n)
          This method just iterates the type-specific version of next() for at most n times, stopping if Iterator.hasNext() becomes false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Iterator
hasNext
 

Constructor Detail

AbstractBooleanIterator

protected AbstractBooleanIterator()
Method Detail

nextBoolean

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

Specified by:
nextBoolean in interface BooleanIterator
Returns:
the next element in the iteration.
See Also:
Iterator.next()

next

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

Specified by:
next in interface Iterator<Boolean>

remove

public void remove()
This method just throws an UnsupportedOperationException.

Specified by:
remove in interface Iterator<Boolean>

skip

public int skip(int n)
This method just iterates the type-specific version of next() for at most n times, stopping if Iterator.hasNext() becomes false.

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


Copyright © 2011. All Rights Reserved.