开发者

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))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜