blob: 3ed0fe46c32560ad48c8b84faca4147c50e26d91 (
plain) (
tree)
|
|
scala> import collection.mutable._
import collection.mutable._
scala> val buf = new ListBuffer[Int]
val buf: scala.collection.mutable.ListBuffer[Int] = ListBuffer()
scala> buf += 22
val res0: scala.collection.mutable.ListBuffer[Int] = ListBuffer(22)
scala> buf ++= List(1, 2, 3)
val res1: scala.collection.mutable.ListBuffer[Int] = ListBuffer(22, 1, 2, 3)
scala> buf.toList
val res2: scala.collection.immutable.List[Int] = List(22, 1, 2, 3)
scala> :quit
|