org.openbp.common.util.iterator
Class ArrayIterator

java.lang.Object
  extended by org.openbp.common.util.iterator.ArrayIterator
All Implemented Interfaces:
java.util.Iterator

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

Array iterator class. Implements the Iterator interface to get an iterator for objects contained in an array.

Author:
Heiko Erhardt

Constructor Summary
ArrayIterator(java.lang.Object[] array)
          Default constructor.
ArrayIterator(java.lang.Object[] array, int start, int count)
          Constructor.
 
Method Summary
 boolean hasNext()
          Checks if there are more array elements.
 java.lang.Object next()
          Gets the current array element and advances the current position.
 void remove()
          Always throws an UnsupportedOperationException removal is not supported by this iterator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayIterator

public ArrayIterator(java.lang.Object[] array)
Default constructor. The iterator will iterate all items in the array.

Parameters:
array - Array to iterate

ArrayIterator

public ArrayIterator(java.lang.Object[] array,
                     int start,
                     int count)
Constructor. The iterator will iterate all items in the array, starting with index 'start' and ending with index 'start' + 'count'.

Parameters:
array - Array to iterate
start - Index of the first object to return
count - Number of objects to iterate
Method Detail

hasNext

public boolean hasNext()
Checks if there are more array elements.

Specified by:
hasNext in interface java.util.Iterator

next

public java.lang.Object next()
Gets the current array element and advances the current position.

Specified by:
next in interface java.util.Iterator
Returns:
The object at the current position

remove

public void remove()
Always throws an UnsupportedOperationException removal is not supported by this iterator.

Specified by:
remove in interface java.util.Iterator


Copyright © 2011. All Rights Reserved.