java - Replace Node in linkedList -
java - Replace Node in linkedList -
i'm trying replace node within linkedlist
like :
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); }
i don't understand why @ end of method node has next node ...
java replace linked-list
Comments
Post a Comment