0
我有一段代码如下:从Scala.WrappedArray转换到列表<>
List<Integer> indexes = joinedCols
.map(x-> ((Tuple2)x)._1)
.collect();
return indexes;
我期望indexes
为List<Integer>
类型然而,当我与调试器我看到检查它这是一种WrappedArray
。因此,它的行为不像List
,并且当我想要遍历返回的列表for (Integer i : indexes)
时导致错误。在这种情况下,我如何返回底层列表作为List<Integer>
的类型?
不是一个解决方案,但我发现一个解决方法遍历列表像遍历(对象我:索引)。 – SpiderRico
joinedCols的类型是什么? – puhlen
@puhlen JavaPairRDD – SpiderRico