Jump to content
  • Advertisement
Sign in to follow this  

How do I take a look at HashSet while debugging in Eclipse Expressions?

This topic is 2250 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

Here I am debugging a HashSet variable in Eclipse.

Capture-14.png

I don't know where to look for the [color=#FF0000]contents of the HashSet. Could anyone help me out? Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
The contents are contained in the 'table' member. However since the table is actually an array with the hash of the object used as the index in the array, it will may seem pretty sparsely populated, there will be alot of gaps between cells that actually have values.

Personally, I always override toString() and print all my members' values nicely in there. The debugger displays the return value of toString() in the lower pane, if you don't override it, it falls back to Object.toString() which just prints the Object's class (if my memory is correct) plus the address the object is stored at, which is (usually) not very helpful.

Edit:

While I'm thinking of it, you should also always override .equals() and .hashCode(), especially if you're putting those objects into a Set.

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!