intarsys runtime library

de.intarsys.tools.collection
Class IntervalIterator

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

public class IntervalIterator
extends Object
implements 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(Number from, Number to)
          IntervalIterator constructor .
 
Method Summary
 boolean hasNext()
           
 Object next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntervalIterator

public IntervalIterator(Number from,
                        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 Iterator

next

public Object next()
Specified by:
next in interface Iterator

remove

public void remove()
Specified by:
remove in interface Iterator

intarsys runtime library

Copyright © 2008 intarsys consulting GmbH. All Rights Reserved.