Skip to content

Instantly share code, notes, and snippets.

@reevik
Last active February 14, 2022 19:54
Show Gist options
  • Save reevik/e8a1f5b7eca5f01ede63ec18ee6bdeba to your computer and use it in GitHub Desktop.
Save reevik/e8a1f5b7eca5f01ede63ec18ee6bdeba to your computer and use it in GitHub Desktop.
val list = List(1,2,3,4,5)
list.flatMap(e => List(e - 1, e, e + 1))
> res0: List[Int] = List(0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, 5, 4, 5, 6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment