org.javasimon.callback.lastsplits
Class CircularList.MainIterator

java.lang.Object
  extended by org.javasimon.callback.lastsplits.CircularList.MainIterator
All Implemented Interfaces:
Iterator<T>
Enclosing class:
CircularList<T>

private class CircularList.MainIterator
extends Object
implements Iterator<T>

Main iterator user when the list contains at least one element


Field Summary
private  boolean begin
          Is it first element.
private  int nextIndex
          Index of the element
 
Constructor Summary
private CircularList.MainIterator()
           
 
Method Summary
 boolean hasNext()
          Is there another element in the list
 T next()
          Returns an element and compute the next one
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nextIndex

private int nextIndex
Index of the element


begin

private boolean begin
Is it first element. This flag is required because when firstIndex=lastIndex (ring buffer is completely used) we don't whether it's the first iteration or the last one.

Constructor Detail

CircularList.MainIterator

private CircularList.MainIterator()
Method Detail

hasNext

public boolean hasNext()
Is there another element in the list

Specified by:
hasNext in interface Iterator<T>

next

public T next()
Returns an element and compute the next one

Specified by:
next in interface Iterator<T>

remove

public void remove()
Specified by:
remove in interface Iterator<T>


Copyright © 2013. All Rights Reserved.