The following does not work:
val t: Traversable[Int] = Seq(0, 1, 2) t contains 0
Even changing Traversable to Iterable doesn't help. You need to use Seq or t exists (_ == 0) .
When checking for an implementation, contains is implemented in SeqLike as follows:
def contains[A1 >: A](elem: A1): Boolean = exists (_ == elem)
As exists already implemented for Traversable , why not contains ?
source share