标签:ble while value return ret turn 链表反转 pre stat
/**
* 双向链表反转
*/
public class RevertDoubleNode {
public static class DoubleNode<T> {
public T value;
public DoubleNode pre;
public DoubleNode next;
public DoubleNode(T node) {
this.value = node;
}
}
public static DoubleNode revertDoubleNode(DoubleNode node) {
DoubleNode pre = null;
DoubleNode next = null;
while (node != null) {
next = node.next;
node.next = pre;
node.pre = next;
pre = node;
node = next;
}
return pre;
}
}
标签:ble while value return ret turn 链表反转 pre stat
原文地址:https://www.cnblogs.com/laydown/p/12791112.html