// Simple version of LinkedIntList with the appending add method public class LinkedIntList { private ListNode front; public LinkedIntList() { front = null; } // Adds the given value to the end of the list public void add(int value) { if (front == null) { front = new ListNode(value); } else { ListNode current = front; while(current.next != null) { current = current.next; } current.next = new ListNode(value); } } // Prints all the values in the list with each value // on its own line public void print() { ListNode current = front; while (current != null) { System.out.println(current.data); current = current.next; } } }