public static void main(String[] args) { Map<String, String> map = new HashMap<String,String>(){{put("1","2");}}; scala.collection.mutable.Map<String, String> mapTest = JavaConverters.mapAsScalaMapConverter(map).asScala(); Object objTest = Map$.MODULE$.<String,String>newBuilder().$plus$plus$eq(mapTest.toSeq()); Object resultTest = ((scala.collection.mutable.Builder) objTest).result(); scala.collection.immutable.Map<String,String> resultTest2 = (scala.collection.immutable.Map)resultTest; System.out.println(resultTest2.keySet()); } 感谢 scala中国 群里的: _森_不明所以的吃瓜群众 wxk
Java map转scala map
最新推荐文章于 2024-10-08 10:13:35 发布