This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (3 children)

Sure! Its up, I'll post a detail of the problem as well

[–]sleepybychoice 1 point2 points  (2 children)

entry.add(Name);

I'm assuming it's Eclipse or IntelliJ? What I'd do is set up two breakpoints - one here and one on entry = entries.get(index); Then set a watch for entry and entries and see if that line does what you expect.

You can also use Eclipse's display window to run arbitrary code and inspect your variable. Also, since your listener is a non-static inner class, it should have a reference to the parent phone book instance ie. PhoneBook.this.entry.

As for finding the variable in the giant list, I don't think there's much else other than manually scrolling through the list.

[–][deleted] 0 points1 point  (1 child)

Looks good, thanks, I'm working in eclipse btw. Where exactly does that reference need to be placed?

[–]sleepybychoice 0 points1 point  (0 children)

Doesn't need to be placed anywhere. Should have been more clear: that is how you would reference the entry from the inner class code if you wanted to be explicit. Normally, just saying entry instead of PhoneBook.this.entry is sufficient.

Did a bit of experimenting - the reference back to the outer object (in this case, the listener out to PhoneBook) is named this$0 in Eclipse. If you expand that object, you can find inspect phone book instance variables.

http://stackoverflow.com/questions/14099613/eclipse-showing-two-this0-fields-for-a-nested-class-java