Do you use any tree with duplicate keys? What can I use from standard containers instead of it?
ps. do not offer jgl.
posted 11 years ago
The Java Collections Framework does not offer a Tree class. However, there are tree implementations of some of the collections that ARE available. These include TreeSet and TreeMap.
However, to answer your question, one possible solution is to use a Map (either HashMap or TreeMap) where the value associated with each key is a List (or Map or Set or any other Collection). You can add the multiple values associated with the key to the List then add the List to the Map.
You may find it helpful to go through the Collections trail in Sun's Java Tutorial. Also, the Java API documentation is a great reference when looking for classes and methods to accomplish a specific task. You should familiarize yourself with the documentation. IMO, learning to navigate it is an essential skill when programming in Java.
I hope this helps get you headed in the right direction. Good luck!