【发布时间】:2016-12-13 14:27:25
【问题描述】:
scala中List类中productiterator方法的用例是什么
val l1 = List(1.1, 2.2, 3.3)
val it = l1.productIterator
//I get the following result
res0: Double = 1.1
res1: List[Double] = List(2.2, 3.3)
//but I can get the same using head and tail
l1.head
1.1
l1.tail
List(2.2, 3.3)
【问题讨论】:
-
我在发布我的问题之前阅读了这篇文章。我没有找到满意的答案。它没有解释用例。它讨论了为什么元组中 productIterator 的结果与 List 的结果不同。
标签: scala