de.intarsys.tools.collection
Class IntervalIterator

java.lang.Object
  extended by de.intarsys.tools.collection.IntervalIterator
All Implemented Interfaces:
java.util.Iterator

public class IntervalIterator
extends java.lang.Object
implements java.util.Iterator

Implement an Iterator over a virtual collection of numbers defined by an interval.

The iterator returns every number with (from >.= number) and (number <.= to) starting with from. The current number is incremented by step after every element access.


Constructor Summary
IntervalIterator(java.lang.Number from, java.lang.Number to)
          IntervalIterator constructor .
 
Method Summary
 boolean hasNext()
           
 java.lang.Object next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntervalIterator

public IntervalIterator(java.lang.Number from,
                        java.lang.Number to)
IntervalIterator constructor .

Parameters:
from - The first number to be returned by the iterator.
to - The number defining an upper limit to the numbers in the collection.
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator

next

public java.lang.Object next()
Specified by:
next in interface java.util.Iterator

remove

public void remove()
Specified by:
remove in interface java.util.Iterator