ComparableX<T extends Comparable<T>> extension

Provides comparison operators for Comparable types.

on
  • T

Methods

between(T first, T endInclusive) bool
Returns true when between first and endInclusive. The order of the arguments doesn't matter.
coerceAtLeast(T minimumValue) → T
Ensures that this value is not less than the specified minimumValue.
coerceAtMost(T maximumValue) → T
Ensures that this value is not greater than the specified maximumValue.
coerceIn(T minimumValue, [T? maximumValue]) → T
Ensures that this value lies in the specified range minimumValue..maximumValue.
inRange(Range<T> range) bool
Returns true if in the range.

Operators

operator <(T other) bool
operator <=(T other) bool
operator >(T other) bool
operator >=(T other) bool