Vorrei aggiungere una tupla di tre interi a un ListBuffer. intuitivamente, il mio primo tentativo è il frammento di codice 1, che ha un errore di sintassi, secondo il compilatore. Quindi, ho provato lo snippet 2 e 3, funzioneranno entrambi. Quindi qualcuno potrebbe spiegarmi perché il codice nel frammento 1 sintatticamente sbagliato.scala - aggiungi una tupla all'elencoBuffer
frammento 1
import scala.collection.mutable.ListBuffer
val b : ListBuffer[(Int, Int,Int)] = ListBuffer()
b += (1,1,1)
frammento 2
import scala.collection.mutable.ListBuffer
val b : ListBuffer[(Int, Int,Int)] = ListBuffer()
b += ((1,1,1))
frammento 3
import scala.collection.mutable.ListBuffer
val b : ListBuffer[(Int, Int,Int)] = ListBuffer()
val i = (1,1,1)
b += i
È considerato un bug in scala? – Zee