/** Remove a node from the list. **/ public static void remove(int num, Node head) { Node temp = new Node(); temp.data = num; while (head != null) { if (head.equals(temp)) { temp = temp.next; return; } head = temp; } }