我正在尝试替换linkedList中的节点
像这样:public void setNodeAt(int i, NodeShape nodeToChange) {
if(i == 0){
nodeToChange.setNextNode(firstNode.getNext());
firstNode = nodeToChange;
return;
}
NodeShape previousNode = getNodeAt(i - 1);
NodeShape sTmp = previousNode.getNext().getNext();
nodeToChange.setNextNode(sTmp);
previousNode.setNextNode(nodeToChange);
}
我不明白为什么但是在方法结束时节点对下一个节点本身...