Now I am confused. I am quite new on Scala, having worked with it for a few weeks, I think I am getting familiar with it, but I am stuck on the apparently trivial following case.
I cannot find the Scala equivalent to this Java declaration :
public static <T extends Comparable<T>> List<T> myMethod(List<T> values) {
// ...
final List<T> sorted = new ArrayList<T>(values);
Collections.sort(sorted);
// ...
}
I thought the following would do :
def myMethod[A >: Ordering[A]](values: Seq[A]): Seq[A] = {
// ...
val sorted = values.sorted
//
}
However, I get the following errors:
error: illegal cyclic reference involving type A
error: diverging implicit expansion for type scala.math.Ordering[A] starting with method Tuple9 in object Ordering
Where am I wrong?