标签:print eve import for rem 数组遍历 reverse 移除 cal
#scala数组
val A= new Array[T](N) val A = new Array[Int](10)
##变长数组
import scala.collection.mutable.ArrayBuffer
val C = new ArrayBuffer[T]()
C += e1
C += (e2,e3)
C++ = Array(e2,e3)
trimEnd(2) #移除最后2个
C.insert(2,e3)
C.remove(3,2)
#转换
D=C.toArray #变长->定长
E=A.toBuffer #定长->变长
#数组遍历
for(i <- C) print ln(i)
for(i <- 0 to (C.length-1)) print (C(i))
for(i<- 0 to (C.length-1,2)) print (C(i)) 每两个输出一个
for ( i <- (0 to C.length).reverse)println(C(i))
标签:print eve import for rem 数组遍历 reverse 移除 cal
原文地址:http://www.cnblogs.com/fs-xuehua/p/6193075.html