assert Sorted
fun <T : Comparable<T>> Sequence<T>.assertSorted(sortOrder: SortOrder = ASCENDING): SortedSequence<T, T>
Creates a SortedSequence from this sequence, asserting that elements are sorted according to their natural order.
Example:
val sequence = sequenceOf(1, 2, 3).assertSorted()
assertEquals(listOf(1, 2, 3), sequence.toList())
Content copied to clipboard
Return
A sorted sequence wrapper
Parameters
T
The type of elements in the sequence, must be comparable
sort Order
The sort order to verify against (default: ASCENDING)