Sign in to follow this  
Lothia

Help, linkedlist comparing problem

Recommended Posts

Lothia    102
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]

Share this post


Link to post
Share on other sites
DaBono    1496
Comparing strings using == checks if the are at the same memory location. Using String.equals you check if the texts are the same.

Share this post


Link to post
Share on other sites
Lothia    102
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]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this