_order
Def
Sort
Sort
Sorts stream elements with given Ordering
Stream(5, 1, 4, 2, 3).sort.tp // Prints Stream(1, 2, 3, 4, 5)
- Source
- _order.scala
Sort by property
Sort by property
Sorts stream of elements based on a single property
Stream("aaaa", "bb", "ccc", "d").sortBy(_.length).tp
// Output
Stream(d, bb, ccc, aaaa)
- Source
- _order.scala
Sort by two properties
Sort by two properties
Sorts stream on first property, and then, if indeterminate on second
- Source
- _order.scala
inline def sortBy[B](f1: A => B, f2: A => C, f3: A => D)(using Ordering[B], Ordering[C], Ordering[D]): Stream[A]
Sort by three properties
Sort by three properties
Sorts stream on first property, then if indeterminate on second, etc...
- Source
- _order.scala
Sort reversed
Sort reversed
Reverse sorts stream elements with given Ordering
Stream(5, 1, 4, 2, 3).sortReversed.tp // Prints Stream(5, 4, 3, 2, 1)
- Source
- _order.scala