com.cafesoft.core.collections
Class ArrayIterator

java.lang.Object
  |
  +--com.cafesoft.core.collections.ArrayIterator
All Implemented Interfaces:
Iterator

public class ArrayIterator
extends Object
implements Iterator

The ArrayIterator class implements the Iterator interface. The underlying storage mechanism for the iterator's data is an array supplied to the constructor of the class. The methods of the Iterator interface simply navigate the array. The remove method is not supported in this implementation of the class.

Since:
8/12/03
See Also:
Iterator

Constructor Summary
ArrayIterator(Object[] data)
          Create a new ArrayIterator.
 
Method Summary
 boolean hasNext()
          Returns true if the iteration has more elements.
 Object next()
          Returns the next element in the iteration.
 void remove()
          Removes from the underlying collection the last element returned by the iterator (optional operation).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayIterator

public ArrayIterator(Object[] data)
Create a new ArrayIterator.

Parameters:
data - an array of data to iterate over.
Method Detail

hasNext

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

Specified by:
hasNext in interface Iterator
Returns:
true if the iterator has more elements, false otherwise.

next

public Object next()
Returns the next element in the iteration.

Specified by:
next in interface Iterator
Returns:
the next element in the iteration.
Throws:
NoSuchElementException - iteration has no more elements.

remove

public void remove()
Removes from the underlying collection the last element returned by the iterator (optional operation).

NOTE:This method is not supported

Specified by:
remove in interface Iterator
Throws:
UnsupportedOperationException - if the remove operation is not supported by this Iterator.


Generated on 10:40:31 AM September 10, 2003, © 1996-2003 Cafésoft LLC. All rights reserved.