I don't understand the purpose for the signature of the
sorted
SeqLike
def sorted[B >: A](implicit ord: Ordering[B]): Repr
B>:A
Repr
Ordering
which should be able to handle some supertype of A
(hence B >: A
). I.e. you should be able to use an Ordering[AnyVal]
to compare Int
values (as AnyVal
is a supertype of Int
).Repr
is a type parameter of the SeqLike
trait itself (SeqLike[+A, +Repr]
) described as "the type of the actual collection containing the elements". This is meant to ensure that methods like sorted
will return a collection of the same type (e.g. List.sorted
will still be a List
).