com.aliasi.util
Class Iterators.ArraySlice<E>

java.lang.Object
  extended by com.aliasi.util.Iterators.ArraySlice<E>
All Implemented Interfaces:
Iterator<E>
Enclosing class:
Iterators

public static class Iterators.ArraySlice<E>
extends Object
implements Iterator<E>

An Iterators.ArraySlice iterates over a slice of an array specified by start index and length.

Since:
LingPipe1.0
Version:
3.0
Author:
Bob Carpenter

Constructor Summary
Iterators.ArraySlice(E[] objects, int start, int length)
          Construct an iterator over the specified array of objects that begins at the object at the specified start index and carries through to the other objects.
 
Method Summary
 boolean hasNext()
          Returns true if there are more objects to return.
 E next()
          Returns the next object for this iterator, throwing an exception if there are no more objects left.
 void remove()
          Throws an UnsupportedOperationException.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Iterators.ArraySlice

public Iterators.ArraySlice(E[] objects,
                            int start,
                            int length)
Construct an iterator over the specified array of objects that begins at the object at the specified start index and carries through to the other objects.

Parameters:
objects - Array of objects over which to iterate.
start - Index of first object to return.
Method Detail

hasNext

public boolean hasNext()
Returns true if there are more objects to return.

Specified by:
hasNext in interface Iterator<E>
Returns:
true if this iterator has more elements.

next

public E next()
Returns the next object for this iterator, throwing an exception if there are no more objects left.

Specified by:
next in interface Iterator<E>
Returns:
Next object from this iterator.
Throws:
NoSuchElementException - If there are no more elements to return.

remove

public void remove()
Throws an UnsupportedOperationException.

Specified by:
remove in interface Iterator<E>
Throws:
UnsupportedOperationException - If called.