请问对于下面的代码,怎样能只在while补全代码,就能使该函数达到单链表反转的效果!请大家帮帮忙!
class Node {
int data;
Node next;
}
public Node reverse(Node head) {
Node newhead = null;
Node current = head;
while (current != null) {
}
return newhead;
}
Node next = current.next;
current.next = newhead;
newhead = current;
current = next;