Comparator

fun interface Comparator<in Element>(source)

Provides comparison of two elements. Alternative of Kotlin stdlib Comparator but with result of type ComparisonResult.

Type Parameters

Element

The type of elements this comparator can compare.

Types

Link copied to clipboard
object Companion

Companion object for Comparator interface providing factory methods for creating Comparator instances.

Properties

Link copied to clipboard

Returns a Comparator for nullable elements where null is considered the greatest value.

Link copied to clipboard

Returns a Comparator for elements wrapped in Maybe where None is considered the least value.

Link copied to clipboard

Returns a Comparator for nullable elements where null is considered the greatest value.

Link copied to clipboard

Returns a Comparator for nullable elements where null is considered the least value.

Functions

Link copied to clipboard

Order builder from a Comparator that compares the left and right elements to each other.

Link copied to clipboard
abstract fun compare(left: Element, right: Element): ComparisonResult

Compares left and right elements.