public void swap(Node x, Node y) {
    int temp;

    temp = x.data;
    x.data = y.data;
    y.data = temp;
  }
Esempio n. 2
0
 public void deleteNode(Node node) {
   if (node.next != null) {
     node.data = node.next.data;
     node.next = node.next.next;
   } else {
     throw new NoSuchElementException();
   }
 }