|NO.Z.00067|——————————|BigDataEnd|——|Hadoop&Scala.V06|——|Scala.v06|集合|与Java集合的转换|
一、与Java集合的转换
### --- 与Java集合的转换
~~~ 使用 scala.collection.JavaConverters 与Java集合交互。
~~~ 它有一系列的隐式转换,添加了asJava和asScala的转换方法。
### --- 编程示例
import scala.collection.JavaConverters._
val list: Java.util.List[Int] = List(1,2,3,4).asJava
val buffer: scala.collection.mutable.Buffer[Int] = list.asScala
Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
——W.S.Landor
浙公网安备 33010602011771号