Programming in Scala 3rd edition中的一个问题

第48页的例子中scala

thrill.sort((s,t)=>

 | s.charAt(0).toLower <

 | t.charAt(0).toLower)

在Scala 2.12.3版本中运行会报错,显示code

error: value sort is not a member of List[String]it

查阅了Scala的API,应该使用sortWith方法class

thrill.sortWith((s,t)=>
     | s.charAt(0).toLower <
     | t.charAt(0).toLower)
相关文章
相关标签/搜索