32 import java.util.Iterator;
33 import java.util.NoSuchElementException;
49 throw new UnsupportedOperationException();
59 public static <E> Iterator<E>
iterator(
final E[] array) {
60 return new Iterator<E>() {
65 private int index = 0;
75 public boolean hasNext() {
76 return (index < array.length);
89 throw new NoSuchElementException();
91 return array[index++];
110 public static void main(
final String[] args) {
112 new String[]{
"one",
"two",
"three"});
114 while (
it.hasNext()) {
115 System.out.println(
it.next());