tree data structure in java

TreeMap Tutorial Java

TreeMap is derived from SortedMap interface and attains the property of printing the elements in ascending order. With Comparator, the order can be changed. The Comparator should be supplied at the time of TreeMap object creation itself. Methods of TreeMap are not synchronized and thereby not thread-safe. Using in multithreaded environment is not advisable. A …

TreeMap Tutorial Java Read More »

TreeSet Tutorial Constructors Methods

TreeSet is derived from SortedSet interface. We know earlier, SortedSet is derived from Set and Set is derived from Collection. A complete hierarchy is available at "Java Collections Interfaces Hierarchy". TreeSet is very powerful as it can make use of all the methods of Collection (like iterator() and add()); stores only unique elements, a feature …

TreeSet Tutorial Constructors Methods Read More »