Skip to content

Instantly share code, notes, and snippets.

@SebastianAas
Last active January 21, 2021 13:05
Show Gist options
  • Save SebastianAas/cc809cbb9374ac86ef38bf844f7cecff to your computer and use it in GitHub Desktop.
Save SebastianAas/cc809cbb9374ac86ef38bf844f7cecff to your computer and use it in GitHub Desktop.
Sum of collections
for {
a1 <- Future(Set(1, 2, 3))
b1 <- Future(Set(1, 2, 3))
} yield {
for {
x <- a1
y <- b1 if y > 2
} yield {
x + y
}
}
//Result: Future[Set(4,5,6)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment