3

Reading http://www.scala-lang.org/api/2.11.1/index.html#scala.collection.TraversableOnce:

Directly subclassing TraversableOnce is not recommended - instead, consider declaring an Iterator with a next and hasNext method, creating an Iterator with one of the methods on the Iterator object, or declaring a subclass of Traversable.

Why is subclassing TraversableOnce not recommended?

1 Answer 1

1

It's because you would have to implement 12 relatively complex abstract methods, whereas with the recommended alternatives, you get that functionality much more easily. TraversableOnce is there to provide a convenient abstract type for a function argument.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.