What is Scala's Comparable trait?

greenoldman picture greenoldman · Oct 9, 2011 · Viewed 10.3k times · Source

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.

Answer

missingfaktor picture missingfaktor · Oct 9, 2011

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.