About 37,100 results
Open links in new tab
  1. Comparable (Java Platform SE 8 ) - Oracle

    Objects that implement this interface can be used as keys in a sorted map or as elements in a sorted set, without the need to specify …

  2. Java Comparable Interface - GeeksforGeeks

    Oct 1, 2026 · The Comparable interface in Java is used to define the natural ordering of objects of a class. It enables objects to be …

  3. Comparable (Java SE 25 & JDK 25) - docs.oracle.com

    Objects that implement this interface can be used as keys in a sorted map or as elements in a sorted set, without the need to specify …

  4. Java Advanced Sorting (Comparator and Comparable) - W3Schools

    A comparable is an object which can compare itself with other objects. It is easier to use the Comparable interface when possible, …

  5. Java - How to Use Comparable? - Online Tutorials Library

    Comparable interface is a very important interface which can be used by Java Collections to compare custom objects and sort them. …

  6. Java Comparable Interface: compareTo () and Natural Ordering

    Oct 10, 2026 · Learn the Java Comparable interface with compareTo () examples, the contract rules, the subtraction and equals () …

  7. Comparator and Comparable in Java - Baeldung

    Dec 1, 2017 · In this article, we explored the Comparable and Comparator interfaces, and discussed the differences between them. …

  8. Java Comparable vs Comparator - GeeksforGeeks

    Sep 2, 2026 · Comparable and Comparator are interfaces used to define the ordering of objects for sorting. Comparable is used …

  9. How to implement the Java comparable interface? - Stack Overflow

    I am not sure how to implement a comparable interface into my abstract class. I have the following example code that I am using to …

  10. Java Comparable Interface - Complete Tutorial with Examples

    Apr 13, 2025 · This tutorial covered the Comparable interface with practical examples. Implementing Comparable enables natural …