com.ibm.mashups.enabler
Interface Iterator


public Iterator

Extended iterator interface, which allows iterating over elements in a sequentiell order. It allows to set the starting point of the iteration and exposes the number of elements in the iteration.


Method Summary
 Boolean hasNext()
           Returns true if the iteration has more elements.
 Object next()
           Returns the next element in the iteration.
 Deferred size()
           Returns the number of elements in this iterator.
 void setCursorPosition(int position)
           Sets the zero-based position of the cursor, i.e the last element is addressed through size()-1.
 int getCursorPosition()
           Returns the zero-based position of the cursor, i.e. zero for the first element
 

Method Detail

hasNext

Boolean hasNext()
Returns true if the iteration has more elements.

Returns:
true if the iterator has more elements, otherwise false.

next

Object next()
Returns the next element in the iteration. Calling this method repeatedly until the hasNext() method returns false will return each element in the underlying collection exactly once. The cursor position is increased by one. if no element is available at the specified position, null is returned and the position is not changed

Returns:
the next element in the iteration

size

Deferred size()
Returns the number of elements in this iterator.

Returns:
a deferred object used to start this operation. The return value when executed through the deferred object is the number of elements in this iterator

setCursorPosition

void setCursorPosition(int position)
Sets the zero-based position of the cursor, i.e the last element is addressed through size()-1. A position which is out of the bounds of the current iteration is ignored and in this case the position is set to the nearest possible value within valid bounds.

Parameters:
position - position of the cursor. Defaults to zero

getCursorPosition

int getCursorPosition()
Returns the zero-based position of the cursor, i.e. zero for the first element

Returns:
the position of the cursor


Copyright IBM Corp. 2010 All Rights Reserved.