9

I am searching for Scala counterpart of C# IComparable, and I found Comparable trait. I mean -- Comparable is mentioned, but when I search for it at http://www.scala-lang.org/api/current/scala/ I get 0 hits. Because of the name, using Google I get a lot of "how Scala is comparable to..." results.

Is there any resource I could read about this mysterious Comparable thing? After all Ordered extends it, so it has to exist.

greenoldman
  • 16,895
  • 26
  • 119
  • 185

1 Answers1

18

The Comparable that you saw mentioned must have been java.lang.Comparable. There is no trait named Comparable in Scala stdlib. Scala's Ordered trait extends java.lang.Comparable.

missingfaktor
  • 90,905
  • 62
  • 285
  • 365
  • Thank you. In such case I consider Ordered info quite misleading, it says "trait Ordered [A] extends Comparable[A]", see: http://www.scala-lang.org/api/current/scala/math/Ordered.html – greenoldman Oct 09 '11 at 09:22
  • 4
    @macias And if you keep the mouse over "Ordered" to see where's from, you'll see a hint box popping up with "java.lang.Comparable". Also, if it were from Scala, it would be a link -- though that's just a deficiency in Scaladoc, as we'd like for it to link to Javadoc. – Daniel C. Sobral Oct 09 '11 at 14:41