I want to use the tree in java but I found tree Set, Tree map
I want to know each of them would be used and if I add element to the root how can I add element to this element.

Talking about elements in a Tree, you, then, don't want either of those. Those are simple sets and maps and the "tree" portion of those only refer to the sorting order. If you need a pre-finished class that can handle trees then see the API docs for DefaultTreeModel (normally used for JTree and GUIs).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.