# Comparator

open class Comparator<T> : Comparator<T> (source)

A comparator implementation based on the names returned by the given namer.

#### Parameters

<T>

The type of object that the namer can name

## Constructors

Comparator
Link copied to clipboard
constructor(namer: Namer<in T>)

## Functions

compare
Link copied to clipboard
open fun compare(o1: T, o2: T): Int
comparing
Link copied to clipboard
open fun <T, U> comparing(keyExtractor: (in T) -> out U, keyComparator: Comparator<in U>): Comparator<T>
comparingDouble
Link copied to clipboard
open fun <T> comparingDouble(keyExtractor: ToDoubleFunction<in T>): Comparator<T>
comparingInt
Link copied to clipboard
open fun <T> comparingInt(keyExtractor: ToIntFunction<in T>): Comparator<T>
comparingLong
Link copied to clipboard
open fun <T> comparingLong(keyExtractor: ToLongFunction<in T>): Comparator<T>
equals
Link copied to clipboard
open fun equals(obj: Any): Boolean
hashCode
Link copied to clipboard
open fun hashCode(): Int
naturalOrder
Link copied to clipboard
open fun <T : Comparable<in T>?> naturalOrder(): Comparator<T>
nullsFirst
Link copied to clipboard
open fun <T> nullsFirst(comparator: Comparator<in T>): Comparator<T>
nullsLast
Link copied to clipboard
open fun <T> nullsLast(comparator: Comparator<in T>): Comparator<T>
reversed
Link copied to clipboard
open fun reversed(): Comparator<T>
reverseOrder
Link copied to clipboard
open fun <T : Comparable<in T>?> reverseOrder(): Comparator<T>
thenComparing
Link copied to clipboard
open fun thenComparing(other: Comparator<in T>): Comparator<T>
thenComparingDouble
Link copied to clipboard
open fun thenComparingDouble(keyExtractor: ToDoubleFunction<in T>): Comparator<T>
thenComparingInt
Link copied to clipboard
open fun thenComparingInt(keyExtractor: ToIntFunction<in T>): Comparator<T>
thenComparingLong
Link copied to clipboard
open fun thenComparingLong(keyExtractor: ToLongFunction<in T>): Comparator<T>