blob: 3fa10328348a983c1a93ec7b46dc72af83fe13c1 (
plain) (
tree)
|
|
scala> import scala.collection.mutable
import scala.collection.mutable
scala> val buf = mutable.ListBuffer[Int]()
buf: scala.collection.mutable.ListBuffer[Int] = ListBuffer()
scala> object o {
| val xs = List(1, 2, 3)
| }
defined module o
scala> import o._
import o._
scala> buf += xs
<console>:11: error: type mismatch:
found : scala.collection.immutable.List[Int](o.xs)
required: String
buf += xs
^
<console>:11: error: type mismatch:
found : String
required: scala.collection.mutable.ListBuffer[Int]
buf += xs
^
scala> buf ++= xs
res1: scala.collection.mutable.ListBuffer[Int] = ListBuffer(1, 2, 3)
scala> :quit
|