Have a Question?

If you have any question you can ask below or enter what you are looking for!

Tag: Difference between Comparator and Comparable in Java?

Difference between Comparator and Comparable in Java?

Difference between Comparator and Comparable in Java? Comparator[I] It is present in java.lang package and it contains only one method. [highlight]compareTo()[/highlight];   If we are depending on default natural sorting order then while adding the object into the TreeSet JVM will call compareTo() method.  If default natural sorting order not available or . . . Read more