many thanks for the kind words
Type: Posts; User: Norm
many thanks for the kind words
It always did for me.
Where is the value of curr set? It's an argument to a method. What is its value when the call is made?
Is null a valid value? What would it be if the list is empty?
Sorry I don't understand where you are referencing curr that it is null. I assume that curr is the value passed to a method. Can you show the code and the debug output that shows when it is null?
What is the logic? Your code has no comments so I don't know what your logic is.
When I added these two comments at the appropriate places in the code, I saw what was wrong and was able to fix it....
Time to get out the paper and pencil and work thru how the links should be set and when.
I notice that there are no comments in the code as to what it needs to do at each point in the logic.
For...
I don't know how you are debugging. I use printlns.
For good debug output you need to add a toString method to Node class:
public String toString() {
return...
Could you send the one I'm to test. Not edits needed.
The one you sent was unformatted. I don't like working with unformatted code.
Be sure the code is formatted.
The one that shows the problem.
Can you post code that compiles and executes that shows the problem?
Remember to add code tags: BB Code List - Java Forums