Following does not work:
val t: Traversable[Int] = Seq(0, 1, 2)
t contains 0
Even changing Traversable
to Iterable
does not help. One needs to use Seq
, or t exists (_ == 0)
.
When checking the implementation, contains
is implemented in SeqLike
as follows:
def contains[A1 >: A](elem: A1): Boolean = exists (_ == elem)
As exists
is already implemented for Traversable
, why not contains
?