You probably need to set the content of other
to be empty. The code you posted merely sets c
to null but c
is a local variable about to go out of scope anyway. You probably need to change other._head = 0
.
Note that your code unnecessarily sets up a
and d
. Likewise, temp
isn't really needed: you could just use c
instead.