Linkedlist class Java

//LinkedListADT

public interface LinkedListIntADT {
public boolean isEmptyList();
public void initializeList();
public void print();
public int length();
public int front();
public int back();
public boolean search(int searchItem);
public void insertFirst(int newItem);
public void insertLast(int newItem);
public void deleteNode(int deleteItem);
}

//LinkedListClass

//Class: LinkedListIntClass implements
//Interface: LinkedListIntADT
import java.util.*;
public abstract class LinkedListIntClass implements LinkedListIntADT {
protected class LinkedListNode {
public int info;
public LinkedListNode link;
//Default constructor
public LinkedListNode() {
info = 0;
link = null;
}

//Alternate constructor
public LinkedListNode(int elem, LinkedListNode ptr) {
info = elem;
link = ptr;
}
} //end class LinkedListNode

//Instance variables of the class LinkedListIntClass
protected LinkedListNode first; //address of the first node/list
protected LinkedListNode last; //address of the last node/list
protected int count; //number of nodes in the list

//Default constructor
public LinkedListIntClass() {
first = null;
last = null;
count = 0;
}

public boolean isEmptyList() {
return (first == null);
}

public void initializeList() {
first = null;
last = null;
count = 0;
}

public void print() {
LinkedListNode current; //variable to traverse the list
current = first;
while (current != null) {//while more data to print
System.out.print(current.info + " ");
current = current.link;
}
}

public int length() {
return count;
}

public int front() {
return first.info;
}

public int back() {
return last.info;
}

public abstract boolean search(int searchItem);
public abstract void insertFirst(int newItem);
public abstract void insertLast(int newItem);
public abstract void deleteNode(int deleteItem);
}

//UnorderedLinkedListInt

//Class: UnorderedLinkedListInt extends
//Class: LinkedListClass
public class UnorderedLinkedListInt extends LinkedListIntClass {
//Default constructor
public UnorderedLinkedListInt() {
super();
}

public boolean search(int searchItem) {
LinkedListNode current; //variable to traverse the list
current = first;
while (current != null)
if (current.info == searchItem)
return true;
else
current = current.link;
return false;
}

public void insertFirst(int newItem) {
LinkedListNode newNode; //variable to create the new node
//create and insert newNode before first
newNode = new LinkedListNode(newItem, first);
first = newNode;
if (last == null)
last = newNode;
count++;
}

public void insertLast(int newItem) {
LinkedListNode newNode; //variable to create the new node
//create newNode
newNode = new LinkedListNode(newItem, null);
if (first == null) {
first = newNode;
last = newNode;
}
else {
last.link = newNode;
last = newNode;

}
count++;
}

public void deleteNode(int deleteItem) {
LinkedListNode current; //variable to traverse the list
LinkedListNode trailCurrent; //variable just before current
boolean found;
//Case 1; the list is empty
if ( first == null)
System.err.println("Cannot delete from an empty list.");
else {
//Case 2: the node to be deleted is first
if (first.info == deleteItem) {
first = first.link;
if (first == null) //the list had only one node
last = null;
count--;
}
else { //search the list for the given info
found = false;
trailCurrent = first; //trailCurrent points to first node
current = first.link; //current points to second node
while (current != null && !found) {
if (current.info == deleteItem)
found = true;
else {
trailCurrent = current;
current = current.link;
}
}
//Case 3; if found, delete the node
if (found) {
count--;
trailCurrent.link = current.link;
if (last == current) //node to be deleted was the last node
last = trailCurrent;
}
else
System.out.println("Item to be deleted is not in the list.");
}
}
}

// New Methods - your job:

//added method sum for a list of int
public int findSum() {
int sum = 0;
LinkedListNode current = first;
while (current!= null) {
sum += current.info;
current = current.link;
}
return sum;
}

//added method min for a list of int
public int findMin() {
if (isEmptyList()) {
System.out.println("Cannot find minimum of an empty list");
}
int min = first.info;
LinkedListNode current = first.link;
while (current!= null) {
if (current.info < min) min = current.info; current = current.link; } return min; } // creates a comma-separated, bracketed version of the list public String toString() { String bracket = ""; LinkedListNode current = first; System.out.print("["); while (current!= null) { bracket = bracket + current.info + " ,"; current = current.link; } if (bracket.length() > 0) {
bracket = bracket.substring(0, bracket.length() - 1);
}
System.out.print(bracket + "]");
return bracket;
}
}

//ClientUnorderedLinkedListInt

//Class: ClientUnorderedLinkedListInt
//Input: 37 10 88 59 27 20 14 32 89 100 12 999
import java.util.*;
public class ClientUnorderedLinkedListInt {
static Scanner input = new Scanner(System.in);
public static void main(String[] args) {
UnorderedLinkedListInt intList = new UnorderedLinkedListInt();
UnorderedLinkedListInt tempList;
int num;
num = getInt(input, "Enter integers (999 to stop)");
while (num != 999) {
intList.insertLast((Integer) num);
num = getInt(input, "");
}
System.out.print("\nTesting .insertLast and .print. The original list is: ");
intList.print();
System.out.println("\nTesting .length. The length of the list is: " + intList.length());
if (!intList.isEmptyList()) {
System.out.println("Testing .front. First element/list: " + intList.front());
System.out.println("Testing .back. Last element/list: " + intList.back());
}
System.out.println("Testing .sum. The sum of data in all nodes is: " + intList.findSum());
System.out.println("Testing .min. The smallest data in all nodes is: " + intList.findMin());
System.out.print("Testing .search. Enter the number to search for/list: ");
num = input.nextInt();
if (intList.search(num))
System.out.println(num + " found in this list.");
else
System.out.println(num + " is not in this list.");
System.out.print("Testing .remove. Enter the number to be deleted from list: ");
num = input.nextInt();
intList.deleteNode(num);
System.out.print("Testing .toString. After deleting " + num + ", the list is: " + intList);
//intList.print();
System.out.println("\nThe length of the list after delete is: " + intList.length());
}

public static int getInt(Scanner sc, String prompt) {
System.out.println(prompt);
while (!sc.hasNextInt()) {
sc.next();
System.out.print("Not an integer! try again: ");
}
return sc.nextInt();

}

}