_order

trait _order[A]
class java.lang.Object
trait scala.Matchable
class Any
trait _build
object Stream

Def

inline def sort(using o: Ordering[A]): Stream[A]

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
inline def sortBy[B](f: A => B)(using o: Ordering[B]): Stream[A]

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
inline def sortBy[B](f1: A => B, f2: A => C)(using Ordering[B], Ordering[C]): Stream[A]

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
inline def sortReversed(using o: Ordering[A]): Stream[A]

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