Anton Ashanin Anton Ashanin - 2 years ago 94
Scala Question

Scala error: value sort is not a member of List

Following a simple example at I get:

scala> val lst=List(1,7,2,8,5,6,3,9,14,12,4,10)
lst: List[Int] = List(1, 7, 2, 8, 5, 6, 3, 9, 14, 12, 4, 10)

scala> lst.sort(_>_)
<console>:9: error: value sort is not a member of List[Int]

What is wrong?

Answer Source

SimplyScala wasn't updated for a long long time: .sort was deprecated in 2.8.0 and cut out in latter versions. Instead you have to use sortWith method.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download