Package de.jungblut.datastructure
Class ArrayIterator<E>
- java.lang.Object
-
- de.jungblut.datastructure.ArrayIterator<E>
-
- All Implemented Interfaces:
java.util.Iterator<E>
public final class ArrayIterator<E> extends java.lang.Object implements java.util.Iterator<E>Generic ArrayIterator.- Author:
- thomas.jungblut
-
-
Constructor Summary
Constructors Constructor Description ArrayIterator(E[] array)Get a new ArrayIterator for the given array.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetIndex()booleanhasNext()Checks if the iterator has something to iterate by checking the current iteration index against the array length.Enext()voidremove()Removes the current item from the list.
-
-
-
Constructor Detail
-
ArrayIterator
public ArrayIterator(E[] array)
Get a new ArrayIterator for the given array.
-
-
Method Detail
-
hasNext
public final boolean hasNext()
Checks if the iterator has something to iterate by checking the current iteration index against the array length.- Specified by:
hasNextin interfacejava.util.Iterator<E>- Returns:
- true if there is a next item or false if not.
-
next
public final E next()
- Specified by:
nextin interfacejava.util.Iterator<E>- Returns:
- the next entry in the array.
-
getIndex
public final int getIndex()
- Returns:
- the current index of the last "nexted" item.
-
remove
public final void remove()
Removes the current item from the list.- Specified by:
removein interfacejava.util.Iterator<E>
-
-