Difference between HashSet ,LinkedHashSet and TreeSet?
1. HashSet not maintaining any order ,LInkedHashSet maintaining the insertion Order ,TreeSet is maintaining the Sorting order
2. HashSet and LinkedHashSet uses equals() method in Java for comparison but TreeSet uses compareTo() method
3. HashSet and LinkedHashSet allows null values but TreeSet doesn't allow null values
Here is one example to show the difference between HashSet ,LinkedHashSet and TreeSet
Hashset [vinod, santhosh, ajay]
TreeSet [ajay, santhosh, vinod]
LinkedHashSet [vinod, santhosh, ajay]