## Uses of Interface
java.lang.Comparable

- Packages that use Comparable
  Package | Description
  --- | ---
  java.lang |
  java.lang.annotation |
  java.util |

- - ### Uses of Comparable in java.lang

    Classes in java.lang that implement Comparable
    Modifier and Type | Class and Description
    --- | ---
    `class` | `Boolean` The Boolean class wraps a value of the primitive type `boolean` in an object.
    `class` | `Byte` The `Byte` class wraps a value of primitive type `byte` in an object.
    `class` | `Character` The `Character` class wraps a value of the primitive type `char` in an object.
    `class` | `Double` The `Double` class wraps a value of the primitive type `double` in an object.
    `class` | `Enum<E extends Enum<E>>` This is the common base class of all Java language enumeration types.
    `class` | `Float` The `Float` class wraps a value of primitive type `float` in an object.
    `class` | `Integer` The `Integer` class wraps a value of the primitive type `int` in an object.
    `class` | `Long` The `Long` class wraps a value of the primitive type `long` in an object.
    `class` | `Short` The `Short` class wraps a value of primitive type `short` in an object.
    `class` | `String` The `String` class represents character strings.
    `static class` | `Thread.State` A thread state.

  - ### Uses of Comparable in java.lang.annotation

    Classes in java.lang.annotation that implement Comparable
    Modifier and Type | Class and Description
    --- | ---
    `class` | `ElementType` A program element type.
    `class` | `RetentionPolicy` Annotation retention policy.

  - ### Uses of Comparable in java.util

    Methods in java.util with type parameters of type Comparable
    Modifier and Type | Method and Description
    --- | ---
    `static <T,U extends Comparable<? super U>> Comparator<T>` | Comparator.`comparing(Function<? super T,? extends U> keyExtractor)` Accepts a function that extracts a `Comparable` sort key from a type `T`, and returns a `Comparator<T>` that compares by that sort key.
    `static <K extends Comparable<? super K>,V> Comparator<Map.Entry<K,V>>` | Map.Entry.`comparingByKey()` Returns a comparator that compares `Map.Entry` in natural order on key.
    `static <K,V extends Comparable<? super V>> Comparator<Map.Entry<K,V>>` | Map.Entry.`comparingByValue()` Returns a comparator that compares `Map.Entry` in natural order on value.
    `static <T extends Comparable<? super T>> Comparator<T>` | Comparator.`naturalOrder()` Returns a comparator that compares `Comparable` objects in natural order.
    `static <T extends Comparable<? super T>> Comparator<T>` | Comparator.`reverseOrder()` Returns a comparator that imposes the reverse of the natural ordering.
    `default <U extends Comparable<? super U>> Comparator<T>` | Comparator.`thenComparing(Function<? super T,? extends U> keyExtractor)` Returns a lexicographic-order comparator with a function that extracts a `Comparable` sort key.

Copyright © 2025 API Design. All Rights Reserved.