// scala code
object Test {
import scala.collection.mutable.ArrayBuffer
val buf = new ArrayBuffer[Int]()
buf += 1
buf += 2
buf ++= Array(3, 4)
buf += (5, 6)
buf.insertAll(0, List(11, 11, 11))
buf.insert(0, 22)
buf.toArray
buf -= 11 // remove the first 11
buf.toArray
buf.remove(1)
buf.toArray
buf.remove(1, 3)
buf.toArray
buf.trimStart(1)
buf.trimEnd(1)
buf.toArray
val buf1 = buf.clone()
buf1.toArray
buf.clear
buf.toArray
}
Friday, October 16, 2015
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment