scala, guidelines on return type - when prefer seq, iterable, traversable

后端 未结 5 1087
天命终不由人
天命终不由人 2021-01-31 07:44

When do you choose to type a given function\'s return type as Seq vs Iterable vs Traversable (or alternatively even deeper within Se

5条回答
  •  不思量自难忘°
    2021-01-31 07:56

    Quick note: With Scala 2.13.x, Traversable is out of the picture. Iterable is much more general and it was determined that going forward the duality is not justified. Iterable is now at the top of the collections hierarchy and Traversable has been deprecated.

提交回复
热议问题