1) The Associates single sorting sequence. In other words, we can sort the collection on the basis of single element as id or name or price etc.<br><br>Comparat or s multiple sorting sequence. In other words, we can sort the collection on the basis of multiple elements such as as id, name and price etc.<br><br>2) Comparable affects the class original i.e. actual class ised modifi.<br>Comparator doesn't affect the original class i.e. actual class is not modified.<br><br>3) Provides compareTo() method to sort elements.<br>Comparat or s compare () method to sort elements.<br><br>4) Comparable is found in java.lang package.<br>Comparator is found in java.util package.<br><br>5) We can sort the list elements of the Comparable type byCollections.sort (List) method.<br>We can sort the list elements of the Comparator type byCollections.sort (List, Comparator) method. ...
正在翻譯中..