Help, linkedlist comparing problem
Hello, I am having a minor issue comparing 2 values both should be strings but one is in a linkedlist class (node). It will let me try and compare them but regardless of them being the same it will still say they are different.
The method I need you to look at is killRingContains(String name)
the node class is below the code.
[edit: removed code at request of class instructor -SiCrane]
[Edited by - SiCrane on February 13, 2009 4:15:55 PM]
Comparing strings using == checks if the are at the same memory location. Using String.equals you check if the texts are the same.
I am having trouble again.
For this I am checking if the front of the second LinkedList is null, and I can only do this by graveYard == null;
but the problem is, is it is alays null.
It should only be null once, then I give it the current LinkedList and set that .next to null. But the linkedList data/name has a value.
Please assist
From question above: I am given a linkedlist that I cannot change (its an assignment). and I cannot create any more nodes either. That is why I am asking for help since I cannot change parts i normally would.
[edit: removed code at request of class instructor -SiCrane]
Is there any other way to define it as null?
[Edited by - SiCrane on February 13, 2009 4:49:26 PM]
For this I am checking if the front of the second LinkedList is null, and I can only do this by graveYard == null;
but the problem is, is it is alays null.
It should only be null once, then I give it the current LinkedList and set that .next to null. But the linkedList data/name has a value.
Please assist
From question above: I am given a linkedlist that I cannot change (its an assignment). and I cannot create any more nodes either. That is why I am asking for help since I cannot change parts i normally would.
[edit: removed code at request of class instructor -SiCrane]
Is there any other way to define it as null?
[Edited by - SiCrane on February 13, 2009 4:49:26 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement