tempStart = last;
tempNext = tempStart;
That sets the three variables to point to the same object. There is one object addressed by three reference pointers.
Type: Posts; User: Norm
tempStart = last;
tempNext = tempStart;
That sets the three variables to point to the same object. There is one object addressed by three reference pointers.
That's why you get the stack overflow. next goes to next goes to next forever.
To keep toString() from going forever, change it to return this:
return "Node: " + value + " next=" +...
Do you see what that statement is doing?
Have you taken a piece of paper and drawn the linked list and manually drawn in what that one statement does?
Did you add the toString method I...
You need to look at what the code is doing. What does the above statement do to the list?
What are the values of the two variables?
One good technique I use for debugging linked lists is to add...
Can you post the print out that show what you are talking about? Add printlns as needed to show the problem and add some comments to the print out describing what is wrong and show what the output...