Some IDEs have an option to display a collection's contents in a more "friendly" way instead of displaying the collection's internal data structures. It's probably this way because most programmers are using collections but not debugging them, and therefore seeing the collection's internal structures obscures the collection's contents.
In the NetBeans, this option can be changed by going to Preferences in the Java > Java Debugger category, and setting various "formatters" such as those for Collection, Map, and Map.Entry.
In IntelliJ IDEA, bring up the Settings dialog, and look under Build, Execution, Deployment -> Debugger -> Data Views -> Java. The option is called "Enable alternative view for Collections classes." (Thanks, Matt Leidholm!)
As to the second part of your question, if you're using a TreeMap<K, V>
the API exposes only the types K
and V
that you're using. The TreeMap.Entry
structure is an internal data structure that's kept private from the client. The client can't navigate the tree structure (left/right/parent) itself. The intent of TreeMap
is not to expose a tree structure, but to provide an abstraction of a map whose keys and values are exposed, sorted by key.
You can get Map.Entry
references by calling entrySet()
. These are references to actual TreeMap.Entry
objects. However, the Map.Entry
doesn't expose left/right/parent; it only exposes keys and values.