// Represents a list of integers. public class LinkedIntList { private ListNode front; // post: Constructs an empty list public LinkedIntList() { front = null; } // post: Prints the list contents in one line, separated by spaces public void printList() { ListNode current = front; while (current != null) { System.out.print(current.data + " "); current = current.next; } System.out.println(); } // post: Adds the given value to the end of this list public void add(int value) { if (front == null) { // special case to deal with the empty list front = new ListNode(value); } else { // add at the end of any other length list ListNode current = front; while (current.next != null) { current = current.next; } current.next = new ListNode(value); } } }