Package com.complexible.common.collect
Class ArrayIterator<T>
- java.lang.Object
-
- com.google.common.collect.UnmodifiableIterator<T>
-
- com.complexible.common.collect.ArrayIterator<T>
-
- Type Parameters:
T
- the type of elements that will be iterated over
- All Implemented Interfaces:
com.google.common.collect.PeekingIterator<T>
,java.util.Iterator<T>
public final class ArrayIterator<T> extends com.google.common.collect.UnmodifiableIterator<T> implements com.google.common.collect.PeekingIterator<T>
Class which adapts an array of objects to the Iterator interface, particularly to allow sub-arrays to be iterated over.
- Since:
- 2.0
- Version:
- 5.0
- Author:
- Michael Grove
-
-
Constructor Summary
Constructors Constructor Description ArrayIterator(T[] theArray)
Create a new ArrayIteratorArrayIterator(T[] theArray, int theStart, int theEnd)
Create a new ArrayIterator
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> ArrayIterator<T>
create(T... theElements)
boolean
hasNext()
T
next()
T
peek()
-
-
-
Constructor Detail
-
ArrayIterator
public ArrayIterator(T[] theArray)
Create a new ArrayIterator- Parameters:
theArray
- the array to iterate over
-
ArrayIterator
public ArrayIterator(T[] theArray, int theStart, int theEnd)
Create a new ArrayIterator- Parameters:
theArray
- the array to iterate overtheStart
- the starting position of the arraytheEnd
- the end position of the array
-
-
Method Detail
-
create
@SafeVarargs public static <T> ArrayIterator<T> create(T... theElements)
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfacejava.util.Iterator<T>
-
next
public T next()
-
-