comparatorVScomparable

1 Comparable interface

1.1 Comparable interface has compareTo(T obj) method to be override

can sort based on one field only and we can't chose the field on which we want to sort object.##

2 Comparator interface

2.1 Comparator interface compare(Object o1, Object o2) method need to be implemented.

Last updated

Was this helpful?