org.palo.api.impl.utils
Class ArrayListInt.Iterator

java.lang.Object
  extended by org.palo.api.impl.utils.ArrayListInt.Iterator
Direct Known Subclasses:
ArrayListInt.ListIterator
Enclosing class:
ArrayListInt

public class ArrayListInt.Iterator
extends java.lang.Object

ArrayListInt.Iterator provides a simple forware iterator with basic versioning. This versioning functionality will warn when the arraylist the iterator is associated with has been modified since the point in time when the iterator was instanciated. However this mechanism implemented by a simple counter is not sufficient for detecting shared-memory modifications done by concurrently executing threads. This is only possible to achieve by using synchronization constructs throughout the usage of the list/iterator pair, as the synchronization constructs are the only way of making sure that the independant working memory of each thread is flushed back into main memory.


Method Summary
 boolean hasNext()
          Tests whether there is a next element after the current element that the iterator points to.
 int next()
          Returns the previous element from the iterator.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

hasNext

public boolean hasNext()
Tests whether there is a next element after the current element that the iterator points to.

Returns:
true if there is an element next after the current element.
Throws:
ListModifiedException - thrown if a modification of the array was detected.

next

public int next()
Returns the previous element from the iterator.

Returns:
the previous element
Throws:
ListModifiedException - thrown if a modification of the array was detected.