method iter.sortByDesc
Stable descending sort by key.
Example:
fn main() io {
print("{["fig", "apple", "kiwi"].iter().sortByDesc(s => s.len()).collect()}")
}Output
["apple", "kiwi", "fig"]
pub(api) move fn sortByDesc<K: Ord, effect F>(key: fn(T) -> K F escaping) -> iter<T> FComplexity. O(n log n); the whole input is pulled at the first pull.
Since. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
key | fn(T) -> K F escaping |
Returns
iter<T> F
Effects
none declared (pure unless the body says otherwise)
Defined in: std/core/iter.oxl:526