import java.util.Iterator; import java.util.NoSuchElementException; public class FancyListIterator implements Iterator { protected Position p; // position of next element to return, or null if none protected FancyList fl; // must point to the list too so that we can call its methods public FancyListIterator(FancyList fl) { // fill this in } public boolean hasNext() { // fill this in } public Object next() { // fill this in } // optional, but may be useful when you write iteratorSorted. // public Position nextPosition() { // // fill this in // } /* The java.util.Iterator interface requires us to define a method for destructively removing an element from the list being iterated over. However, we are allowed to just throw an UnsupportedOperationException if we don't want to implement this. */ public void remove() { throw new UnsupportedOperationException("Implementing remove() is an extra credit problem."); } }