I am just curious to know that the Java has provided a COLLECTIONS framework which has some data structures such as LinkedList, ArrayList, Sets, HashMaps but there is no provision for Graphs and Trees. Can you please suggest why these have not been provided since if we have to solve some problem using Breadth First Search or some tree algorithm, then these data structures would have been really helpful.
posted 3 years ago
There are trees, but only as TreeSet, etc.
I think the idea of the collections framework was to provide a wide range of collections, rather than particular data structures. You can use a Set implementation without knowing whether it is based on an array or a tree.
On the other hand, what you want is a particular data structure. Maybe the designers thought that everybody would need different structures or functionality, so thought it better to let them create their own. Of course, you might find a tree to suit your needs in Apache Commons or similar.