having trouble figuring this out, every time i run my code the program goes on forever, everything else in the linked list works perfectly well. including the delete.
public Node smallestValue() {
Node current = firstL;
int min = current.data;
if (!isEmpty()) {
while (current != null) {
if (min < current.data) {
min = current.data;
current = current.next;
}
}
} else {
System.out.println("empty list");
}
System.out.println();
System.out.println(min);
return current;
}
current = current.nextout of theifstatementif (min > current.data).