####从头到尾打印链表
输入一个链表的头结点,逆序打印每个节点的值。
public void travelList(Node head){
Stack<T> stack = new Stack<>();
Node current = head;
while (current != null){
stack.push(current.value);
current = current.next;
}
for (int i = 0; i < stack.size(); i++){
System.out.println(stack.pop());
}
} }