IterableComparableExtension<T extends Comparable<T>> extension Null safety

Extensions that apply to iterables of Comparable elements.

These operations can assume that the elements have a natural ordering, and can therefore omit, or make it optional, for the user to provide a Comparator.

on

Properties

max → T
A maximal element of the iterable.
read-only
maxOrNull → T?
A maximal element of the iterable, or null if the iterable is empty.
read-only
min → T
A minimal element of the iterable.
read-only
minOrNull → T?
A minimal element of the iterable, or null it the iterable is empty.
read-only

Methods

isSorted([Comparator<T>? compare]) bool
Whether the elements are sorted by the compare ordering.
sorted([Comparator<T>? compare]) List<T>
Creates a sorted list of the elements of the iterable.