filterToSorting

inline fun <T> Iterable<T>.filterToSorting(predicate: (first: T, second: T) -> Boolean): List<T>

Returns a sorted list according to the predicate by filtering all unsorted elements.

Example: Strict ordering Given a list: 1, 3, 2, 4 Predicate: first < second Returning list: 1, 3, 4 (2 was dropped, since 3 < 2 is false)

Receiver

iterable to be filtered

Return

filtered list without the unsorted elements

Parameters

predicate

comparison function