com.partnersoft.data
Class ArrayIterator<T>

java.lang.Object
  extended by com.partnersoft.data.ArrayIterator<T>
All Implemented Interfaces:
java.util.Iterator<T>, java.util.ListIterator<T>

public class ArrayIterator<T>
extends java.lang.Object
implements java.util.ListIterator<T>

Simple implementation of an Iterator for an array.

Copyright 2006 Partner Software, Inc.

Version:
$Id: ArrayIterator.java 1626 2008-11-20 15:06:10Z paul $
Author:
Paul Reavis

Constructor Summary
ArrayIterator(T... values)
          Create a new ArrayIterator for the given array.
ArrayIterator(T[] values, int start, int end)
          Create a new ArrayIterator for the given array.
 
Method Summary
 void add(T arg0)
           
 boolean hasNext()
           
 boolean hasPrevious()
           
 T next()
           
 int nextIndex()
           
 T previous()
           
 int previousIndex()
           
 void remove()
           
 void set(T arg0)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayIterator

public ArrayIterator(T... values)
Create a new ArrayIterator for the given array. You can pass in an array or use varargs.


ArrayIterator

public ArrayIterator(T[] values,
                     int start,
                     int end)
Create a new ArrayIterator for the given array. Iteration will begin at the start index, and end before the end index is reached (thus, the range is from start, inclusive to end, exclusive).

Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator<T>
Specified by:
hasNext in interface java.util.ListIterator<T>

next

public T next()
Specified by:
next in interface java.util.Iterator<T>
Specified by:
next in interface java.util.ListIterator<T>

remove

public void remove()
Specified by:
remove in interface java.util.Iterator<T>
Specified by:
remove in interface java.util.ListIterator<T>

add

public void add(T arg0)
Specified by:
add in interface java.util.ListIterator<T>

hasPrevious

public boolean hasPrevious()
Specified by:
hasPrevious in interface java.util.ListIterator<T>

nextIndex

public int nextIndex()
Specified by:
nextIndex in interface java.util.ListIterator<T>

previous

public T previous()
Specified by:
previous in interface java.util.ListIterator<T>

previousIndex

public int previousIndex()
Specified by:
previousIndex in interface java.util.ListIterator<T>

set

public void set(T arg0)
Specified by:
set in interface java.util.ListIterator<T>