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

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -