/* * LinkedListItr.java * * Walter Goodwater * * CSc 300: Copyright Violations * * This code modified from "Data Structures and Algorithm Analysis * in Java", by Weiss */ public class LinkedListItr { ListNode current; ListNode previous; LinkedListItr( ListNode n1, ListNode n2 ) { previous = n1; current = n2; } public boolean isPastEnd( ) { return current == null; } public void advance( ) { if( !isPastEnd() ) { previous = current; current = current.next; } } }