Scala与Java的交互

1、list类型和buffer的自动转换

import scala.collection.mutable.ArrayBuffer
    import scala.collection.JavaConverters.asScalaBuffer
    import java.util.List

    object helloworld {
      def main(args: Array[String]) {

        val buffer = ArrayBuffer(1,3,4);
        val list:java.util.List[Int] = buffer;
        println(list);


  }
}
欢迎关注我的公众号:小秋的博客 CSDN博客:https://blog.csdn.net/xiaoqiu_cr github:https://github.com/crr121 联系邮箱:rongchen633@gmail.com 有什么问题可以给我留言噢~
原文地址:https://www.cnblogs.com/flyingcr/p/10327109.html