Jump to content
  • Advertisement
Sign in to follow this  
Lothia

Help, linkedlist comparing problem

This topic is 4063 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!