Day: December 31, 2018

TreeSet

TreeSet The underlying data structure is balanced tree. Duplicate objects are not allowed. All elements will be inserted, according to some sorting order hence insertion is not preserve. Heterogeneous objects are not allow, violation leads ClassCastException. Constructors:- TreeSet t = new TreeSet (); // natural sorting order. creates an empty TreeSet object where all the […]

SortedSet

SortedSet It is the child interface set. If we want to represent a group of objects without duplicates, according to some sorting order, then we should go for SortedSet interface. The sorting order can be natural sorting order or customized sorting order. SortedSet defines the following six specific methods. Object first (); Object last (); […]