/**
* 单向链表反转
*/
public class RevertLinkedNode {
public static class Node<T> {
public T value;
public Node next;
public Node(T node) {
this.value = node;
}
}
public static Node revertNode(Node node) {
Node pre = null;
Node next = null;
while (node != null) {
next = node.next;
node.next = pre;
pre = node;
node = next;
}
return pre;
}
}