Last updated 2 years ago
Was this helpful?
โฉ Sorting โฉ
seq.sorted()
seq.sorted(by:)
seq.sorted(_:) - sort by keypaths with ascending/descending orders
the sorted(by:) function is actually 2 different functions.
sorted(by:)
one requires Comparable and uses < internally.
Comparable
<
the other lets you specify the sorting logic directly (Comparable conformance not required).
... this convenience sorting by keyPath would still require 2 functions.
keyPath
๐
Sundell โฉ โญ๏ธ
Sarun โฉ
Standard Lib โฉ Collections โฉ
- Element: Comparable
โฉ โฉ
- sort in place. Element: Comparable
- sort in place.
Comparable Enums