scala feature for filtering lists explained

apaj edited this page Sep 3, 2018 · 1 revision

scala> val list1 = List(false,true,true,true) list1: List[Boolean] = List(false, true, true, true)

scala> val list2 = List(1,0,1,1) list2: List[Int] = List(1, 0, 1, 1)

scala> val addr = (list1 zip list2).filter(_._1).map(_._2) addr: List[Int] = List(0, 1, 1)

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.