Tag: comparable

Comparable vs Comparator

August 10, 2011 · 6 min read
At the outset, both are used for ordering the elements of a data structure in the way the programmer desires. Just they differ in their methods of implementation and usage with objects in comparison. These two interfaces are best suitable for ordering the objects depending on their fields. For example, student objects can be ordered on name or marks or age fields.