Closed5

scala の Iterable, IterableOnce

RikiyaOtaRikiyaOta

IterableOnce は1回あるいは複数回走査できるようなコレクションを表す trait。

https://www.scala-lang.org/api/2.13.3/scala/collection/IterableOnce.html

これ自体にはあまりコレクション操作出来るメソッドは無くて、IterableOnceOps に定義されている。mixin していないのは Iterable との大きな違い。

https://www.scala-lang.org/api/2.13.3/scala/collection/IterableOnceOps.html

以下に書いてある通り、最小限のインターフェースを提供することが目的らしい。
普通は以下のコード例にあるように、****Ops を mixin しておくっぽい。Iterable はまさにそう。

https://github.com/scala/scala/blob/2.13.x/src/library/scala/collection/IterableOnce.scala#L25-L40

このスクラップは6ヶ月前にクローズされました