Untitled Document

Subscribe here to get updates on new Videos

 

39. TreeSetDetails part 9?

 

 

 

previous homenext

.

1. For predefined Comparable classes like String default natural sorting order already available. If we are not satisfied with that, we can define our own sorting by Comparator object.

2. For Predefined non comparable classes like StringBuffer, default natural sorting order is not already available. We can define required sorting by implementing Comparator interface.

3. For our own classes like Employee,Student,Customer), the person who is writing own class, he is responsible to define natural sorting order by implementing Comparable interface.

The person who is using our class, if he is not satisfied with default natural sorting order, then he can define his own sorting by using Comparator.