Introduction of TreeSet:
TreeSet is an implementation of Sorted Set interface. It is dynamically resizable data structure. It contains only unique set of elements. TreeSet can increase or decrease its size dynamically.
TreeSet is not synchronized. If more than one thread try to access elements in Set simulataneously and one of the thread modifies the element, JVM throws concurrentmodification exception. Hence, TreeSet should be synchronized in a multi threaded enviornment. TreeSet maintain the order in which elements were inserted to the collection.
TreeSet class in JAVA provides following methods:
1. add(Object element)
2. contains(Object element)
3. remove(int index)
More about TreeSet including time complexity is coming very soon.