Advertisement
mehedi2022

flatmap

Sep 15th, 2022
651
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.25 KB | None | 0 0
  1. val genevaConnectingFlights = flightsDatabase
  2.   .filter(f => f._1 == "Geneva")
  3.   .map { firstLeg =>
  4.     val possibleSecondLegs = flightsDatabase.filter(f => f._1 == firstLeg._2)
  5.     (firstLeg, possibleSecondLegs)
  6.   }
  7. println(genevaConnectingFlights)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement