public void insert(int n) { if (head == null && tail == null) { head = new linkedListNode(n); tail = head; } else { tail.next = new linkedListNode(n); tail = tail.next; } }
public linkedList() { head = null; tail = null; }
public linkedListNode(int input) { this.n = input; this.next = null; }