val org_relation_list: List[Int] = head.get("org_relation").asInstanceOf[java.util.List[Int]]
//报错type mismatch;
found : java.util.List[Int]
required: scala.collection.immutable.List[Int]
org_relation_list
^
上述代码只需要引入隐式转换即可解决
import scala.collection.JavaConversions._
val org_relation_list: Seq[Int] = head.get("org_relation").asInstanceOf[java.util.List[Int]]
//隐式函数定义如下它返回一个mutable.Buffer而不是scala.collection.immutable.List.因此错误.所以替代方法是使用Seq而不是List或将其转换为immutable.List
//implicit def asScalaBuffer[A](l: java.util.List[A]): mutable.Buffer[A]