assert Sorted
fun <TKey : Comparable<TKey>, TValue> Sequence<Pair<TKey, TValue>>.assertSorted(sortOrder: SortOrder = ASCENDING): SortedKeyValueSequence<TKey, TValue>
Creates a SortedKeyValueSequence from this sequence, asserting that elements are sorted by their key.
Example:
val sorted = sequenceOf(1 to "a", 2 to "b").assertSorted()
Content copied to clipboard
Return
A sorted sequence wrapper
Parameters
TKey
The type of keys in the sequence, must be comparable
TValue
The type of values in the sequence
sort Order
The sort order to verify against (default: ASCENDING)