From charlesreid1

Revision as of 01:35, 11 June 2017 by Admin (talk | contribs) (Created page with "Comparable is the interface that is implemented in order for objects to be comparable using operators like < > == etc. https://docs.oracle.com/javase/8/docs/api/java/lang/Com...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Comparable is the interface that is implemented in order for objects to be comparable using operators like < > == etc.

https://docs.oracle.com/javase/8/docs/api/java/lang/Comparable.html

This is a generic type interface, and can be used to define a class that can be compared using custom criteria. For example, we can organize a list according to a very specific method of ordering (right-to-left, filling in with "ghost" titles, as in the Classy problem), or according to custom criteria like when a Cartesian (x,y) point would be visited by a space-filling curve, as with the Hilbert Sort problem.