Below is the code I'm trying to understand:
object Tryouts extends App{
val studentIds= Future{
List("s1","s2","s3")
}
val details = studentIds zip(Future{List("Tim","Joe","Fin")}).map(x=>x.tail)
details.foreach(println)
Thread.sleep(1000)
}
Problem:
val details = studentIds zipper (Future {List ("Tim", "Joe", "Rib")}). Mapping (x => x.tail)
Here, if you notice, I do not use ".". before zip and just giving a space. I think that. and the space works the same, and also checks for some stack overflow problems. the above expression before applying the map will lead me to the Future [(List [String], List [String])]. so when i say
.map (x = x.tail) should show a compilation error in the IDE, since the tail operation can only be used in a list, not a tuple. But it really succeeds.
, "." zip :
val details = studentIds.zip(Future {List ( "Tim", "Joe", "Fin" )}). map (x = > x.tail) (x = > x.tail) .
?