TreeSet in java

TreeSet(Since Java 1.2) Underlying data structure is balanced tree. Duplicates are not allowed. Insertion order is not preserved since objects will be inserted based on some sorting technique. Null insertion is not possible in a non-empty TreeSet. We will get NullPointerException if we add. Heterogeneous objects are not allowed.  We will get ClassCastException if we […]