public void swap(Node x, Node y) { int temp; temp = x.data; x.data = y.data; y.data = temp; }
public void deleteNode(Node node) { if (node.next != null) { node.data = node.next.data; node.next = node.next.next; } else { throw new NoSuchElementException(); } }