Skip to content

Instantly share code, notes, and snippets.

@damog
Created March 17, 2010 03:39
Show Gist options
  • Save damog/334877 to your computer and use it in GitHub Desktop.
Save damog/334877 to your computer and use it in GitHub Desktop.
import java.util.*;
public class ArrayIterator<E> implements Iterator<E> {
private final E[] array;
private final int count;
private int cursor = 0;
public ArrayIterator(E[] contents, int ccount) {
array = contents;
count = ccount;
}
public boolean hasNext() {
if( cursor == count ) {
return false;
} else {
return true;
}
}
public E next() {
E sig = array[cursor];
cursor++;
return sig;
}
public void remove() throws UnsupportedOperationException {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment