在斯卡拉,
test("Appending a tuple to a Buffer"){
val buffer = ArrayBuffer[Int]()
val aTuple = (2, 3)
println(buffer += (2, 3)) // Result : ArrayBuffer(2, 3)
println(buffer += aTuple ) // doesn't compile
}
为什么线
println(buffer += (2, 3))
工作,但线
println(buffer += aTuple )
不编译?