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

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

ubuntu - Bash Script to Check That Files Are Being Created -