org.jboss.portal.common.util
Class IteratorStatus

java.lang.Object
  extended by org.jboss.portal.common.util.IteratorStatus
All Implemented Interfaces:
java.util.Iterator

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

An java.util.Iterator wrapper which keep additional state associated with the wrapped iterator. The implementation of the Iterator interface delegates all operations to the wrapped iterator.

Version:
$Revision: 7228 $
Author:
Julien Viet

Constructor Summary
IteratorStatus(java.util.Collection c)
           
IteratorStatus(java.util.Iterator delegate)
           
 
Method Summary
 int getIndex()
          Returns the index of the last element obtained or -1 if no element has been returned yet.
 boolean hasNext()
           
 boolean isFirst()
          Returns true if one element has been iterated.
 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

IteratorStatus

public IteratorStatus(java.util.Iterator delegate)
               throws java.lang.IllegalArgumentException
Parameters:
delegate - the wrapped iterator
Throws:
java.lang.IllegalArgumentException - if the wrapped iterator is null

IteratorStatus

public IteratorStatus(java.util.Collection c)
               throws java.lang.IllegalArgumentException
Parameters:
c - the collection to iterate
Throws:
java.lang.IllegalArgumentException - if the collection is null
Method Detail

getIndex

public int getIndex()
Returns the index of the last element obtained or -1 if no element has been returned yet.

Returns:
the index of the last element obtained

isFirst

public boolean isFirst()
                throws java.lang.IllegalStateException
Returns true if one element has been iterated.

Returns:
true if one element has been iterated.
Throws:
java.lang.IllegalStateException - if no element has been iterated yet

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