for (int i=0; i < list.getLength(); i++) System.out.println(list.getEntry(i)); array = list.toArray(); //System.out.println(array); for (int i=0; i < array.length; i++) System.out.println(array[i]); public void printList(ListInterface list) { for (int i=0; i < list.getLength(); i++) { System.out.println(list.getEntry(i)); } } //internal public class AList implements ListInterface, Iterator { //all methods for ListInterface public boolean hasNext(); public T next(); public void remove(); } //external public class AListIterator implements Iterator { public boolean hasNext(); public T next(); public void remove(); } public class AList implements ListInterface { //all methods for ListInterface public class AListIterator implements Iterator { private int index; public AListIterator() { index = 1; } public boolean hasNext(); public T next(); public void remove(); } } public class LList implements ListInterface { Node head; //all methods for ListInterface //the Node class public LinkedIterator getIterator() { return new LinkedIterator(); } public class LinkedIterator implements Iterator { Node reference; Node previousNode; public LinkedIterator() { reference = head; previousNode = null; } public boolean hasNext() { if (reference != null) { return true; } return false; } public T next() { //return value of node we're at T value = reference.getValue(); //move to next node previousNode = reference; reference = reference.getNext(); return value; } public void remove() { } } }