scala.collection.Iterable <=> java.lang.Iterable scala.collection.Iterable <=> java.util.Collection scala.collection.Iterator <=> java.util.{ Iterator, Enumeration } scala.collection.mutable.Buffer <=> java.util.List scala.collection.mutable.Set <=> java.util.Set scala.collection.mutable.Map <=> java.util.{ Map, Dictionary } scala.collection.mutable.ConcurrentMap <=> java.util.concurrent.ConcurrentMap scala.collection.Seq => java.util.List scala.collection.mutable.Seq => java.util.List scala.collection.Set => java.util.Set scala.collection.Map => java.util.Map java.util.Properties => scala.collection.mutable.Map[String, String]
注:元组种最大只能22个元素
//元组创建 val tuple = (1,2,"test",3.4,5.7f,'a') println(tuple.getClass.getName) //元组调用 println(tuple._1+"---"+tuple._5) println(tuple.productElement(3)) //元组遍历 for(item<-tuple.productIterator){ println(item) }
//创建Array方式1 val arr1 = new Array[Any](10) //创建Array方式2 val arr2 = Array(1,"3",3.3,'w') //修改 arr1(3) = "333" //遍历 for(i <- arr1){ println("i====="+i) }