this is a noobie question regarding tree maps. I have read through the Java API and other documentation but am still unclear about just how this works.
From my understanding, a Tree in java (or any language) is sort of like a family tree; where you have say:
Layer 1 OldestGuy
Layer 2 OldGuy1 Oldguy2 OldGuy3 OldGuy4 OldGuy5
Layer 3 Guy1 Guy2 Guy3 Guy4 Guy5 Guy6........ etc
TreeMap
is just an implementation of Map
that happens to use a red-black tree behind the scenes. The details of the tree aren't exposed to you, so you can't store elements in arbitrary locations.
To put it another way, a TreeMap
is not a general-purpose tree data structure. If that's what you actually want, perhaps take a look at this Stack Overflow question: Java tree data-structure?.