| java.lang.Object com.nabhinc.util.ArrayIterator
ArrayIterator | public class ArrayIterator implements Iterator(Code) | | author: Padmanabh Dabke author: (c) 2002 Nabh Information Systems, Inc. All Rights Reserved. |
Constructor Summary | |
public | ArrayIterator() Construct an ArrayIterator. | public | ArrayIterator(Object array) Construct an ArrayIterator that will iterate over the values in the
specified array. | public | ArrayIterator(Object array, int start) Construct an ArrayIterator that will iterate over the values in the
specified array. | public | ArrayIterator(Object array, int start, int end) Construct an ArrayIterator that will iterate over the values in the
specified array. |
ArrayIterator | public ArrayIterator()(Code) | | Construct an ArrayIterator. Using this constructor, the iterator is
equivalent to an empty iterator until
ArrayIterator.setArray(Object) is
called to establish the array to iterate over.
|
ArrayIterator | public ArrayIterator(Object array)(Code) | | Construct an ArrayIterator that will iterate over the values in the
specified array.
Parameters: array - the array to iterate over. exception: IllegalArgumentException - if array is not anarray. exception: NullPointerException - if array is null |
ArrayIterator | public ArrayIterator(Object array, int start)(Code) | | Construct an ArrayIterator that will iterate over the values in the
specified array.
Parameters: array - the array to iterate over. Parameters: start - the index to start iterating at. exception: IllegalArgumentException - if array is not anarray. exception: NullPointerException - if array is null |
ArrayIterator | public ArrayIterator(Object array, int start, int end)(Code) | | Construct an ArrayIterator that will iterate over the values in the
specified array.
Parameters: array - the array to iterate over. Parameters: start - the index to start iterating at. Parameters: end - the index to finish iterating at. exception: IllegalArgumentException - if array is not anarray. exception: NullPointerException - if array is null |
getArray | public Object getArray()(Code) | | Retrieves the array that this iterator is iterating over.
the array this iterator iterates over, or null ifthe no-arg constructor was used and ArrayIterator.setArray(Object) has neverbeen called with a valid array. |
hasNext | public boolean hasNext()(Code) | | Returns true if there are more elements to return from the array.
true if there is a next element to return |
next | public Object next()(Code) | | Returns the next element in the array.
the next element in the array throws: NoSuchElementException - if all the elements in the arrayhave already been returned |
setArray | public void setArray(Object array)(Code) | | Changes the array that the ArrayIterator should iterate over. If an
array has previously been set (using the single-arg constructor or this
method), that array along with the current iterator position within
that array is discarded in favor of the argument to this method. This
method can be used in combination with
ArrayIterator.getArray() to "reset"
the iterator to the beginning of the array:
ArrayIterator iterator = ...
...
iterator.setArray(iterator.getArray());
Note: Using i.setArray(i.getArray()) may throw a NullPointerException
if no array has ever been set for the iterator (see
ArrayIterator.getArray() )
Parameters: array - the array that the iterator should iterate over. exception: IllegalArgumentException - if array is not anarray. exception: NullPointerException - if array is null |
|
|