![](/img/trans.png)
[英]Is there a scala/java equivalent of Python 3's collections.Counter
[英]Is there an equivalent to Python's islice in Scala?
在Python中,我可以使用ittools的slice方法轻松地对无限序列进行切片或截断:
list(islice(count(), 3, 5)) -> [3,4]
Scala中是否存在可以切片或截断无限流或迭代器的等效语法?
谢谢!
哦,看起来很简单!
val s = Stream.from(1).iterator
s.slice(0,19).toList
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.