com.evanmclean.evlib.lang
Class ArrayIterable<T>

java.lang.Object
  extended by com.evanmclean.evlib.lang.ArrayIterable<T>
Type Parameters:
T -
All Implemented Interfaces:
Iterable<T>

public class ArrayIterable<T>
extends Object
implements Iterable<T>

Create an Iterable from an array that can produce an Iterator or a ListIterator.

Author:
Evan McLean McLean Computer Services (see the overview for copyright and licensing.)

Constructor Summary
ArrayIterable(T[] arr)
           
ArrayIterable(T[] arr, int start_index)
           
ArrayIterable(T[] arr, int start_index, int end_index)
           
 
Method Summary
static
<T> ArrayIterable<T>
create(T[] arr)
           
static
<T> ArrayIterable<T>
create(T[] arr, int start_index)
           
static
<T> ArrayIterable<T>
create(T[] arr, int start_index, int end_index)
           
 ListIterator<T> iterator()
          Returns an iterator over a set of elements of type T.
 ListIterator<T> listIterator()
          Returns a list iterator over a set of elements of type T.
 ListIterator<T> listIterator(int initial_index)
          Returns a list iterator over a set of elements of type T.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayIterable

public ArrayIterable(T[] arr)

ArrayIterable

public ArrayIterable(T[] arr,
                     int start_index)

ArrayIterable

public ArrayIterable(T[] arr,
                     int start_index,
                     int end_index)
Method Detail

create

public static <T> ArrayIterable<T> create(T[] arr)

create

public static <T> ArrayIterable<T> create(T[] arr,
                                          int start_index)

create

public static <T> ArrayIterable<T> create(T[] arr,
                                          int start_index,
                                          int end_index)

iterator

public ListIterator<T> iterator()
Returns an iterator over a set of elements of type T.

Specified by:
iterator in interface Iterable<T>
Returns:
An iterator over a set of elements of type T.

listIterator

public ListIterator<T> listIterator()
Returns a list iterator over a set of elements of type T.

Returns:
A list iterator over a set of elements of type T.

listIterator

public ListIterator<T> listIterator(int initial_index)
Returns a list iterator over a set of elements of type T.

Parameters:
initial_index - Index of first element to be returned from the list iterator (by a call to the next method).
Returns:
A list iterator over a set of elements of type T.