From charlesreid1

No edit summary
No edit summary
Line 9: Line 9:


{{CSFlag}}
{{CSFlag}}
[[Category:Java]]
[[Category:Comparable]]

Revision as of 22:56, 22 June 2017

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.






See also: