In Scala how do I apply a method to a variable before sorting a List on that variable?
For example suppose I have
val sortedSignal =开发者_如何学C signal.sortBy(_.variable)
And I wish to apply Math.abs to variable before sorting. What is the correct syntax for doing this?
signal.sortBy(x=>Math.abs(x.variable))
精彩评论