flatten is defined as:
override def flatten[B](implicit toIterableOnce: A => IterableOnce[B])
My code is:
val myList = List(1,2,3)
println(myList.map(x => List(x, 2*x)).flatten)
So if I understand it correctly, when I call flatten I need an implicit function defined somewhere and this function takes List[Int] as input and returns IterableOnce[Int].
I haven't defined any such function and code works fine, so implicit is found somewhere. How can I find where its exactly defined? I was expecting it in Predef, but seems its not there.