I have a question about setting the result to Empty (i.e. nothing), I've researched in past questions and did not find a good solution.
The question is quite simple, say I have a List of Int and List of Bool
val a = List(1,2,3,4,5)
val b = List(F,T,T,F,F)
and I want to zip them and do some mapping:
val result = (a,b).zipped.map((x,y)=>(if(b) a else ())
I assume I am doing the right thing above which takes each element of a and b and does the operation where if b is true, return a, else return nothing. I expect the result to only have the numbers (2,3). However, my Eclipse seems to indicate that the result generated is List[AnyVal] instead of List[Int].
I have tested the same setting, but using Lists, and when I set b to List(), the process works and Eclipse is understanding that I want to set an empty List, so I am lost where I when wrong..
Thanks in advance