0
我想合併Scala中的兩個日期序列,使合併序列已排序的元素。我使用的是部分實現isBefore如下:部分應用isBefore函數在斯卡拉給出錯誤
val seq1 = Seq(LocalDate.of(2014, 4, 5), LocalDate.of(2013, 6 ,7), LocalDate.of(2014, 3, 1))
val seq2 = Seq(LocalDate.of(2012, 2, 2), LocalDate.of(2015, 2, 1))
var arr = (seq1 ++ seq2).sortWith(_.isBefore(_) = 1)
println(arr)
但它顯示編譯錯誤的isBefore功能:
Multiple markers at this line
- missing arguments for method isBefore in class LocalDate; follow this method with `_' if you want to
treat it as a partially applied function
- missing arguments for method isBefore in class LocalDate; follow this method with `_' if you want to
treat it as a partially applied function
我是比較新的斯卡拉。什麼似乎是問題?