Oct 19, 2018

Difference between Comparator and Comparable in Java

Though both Comparator and Comparable are interfaces and used to implement comparison logic between two instances of class, need to arrange them in order during sorting process; but there are subtle difference between them, which we will see in this article. Comparator can define custom ordering e.g. sorting same object with different condition but Comparable is usually used to define natural order e.g. numeric in numbers and alphabetic in String.

QuickBooks Self-Employed

Bigger tax refunds. Better organization. Manage your deductions with QuickBooks Self-Employed .