Skip to content

Instantly share code, notes, and snippets.

@iainmcgin
Created February 18, 2013 20:47
Show Gist options
  • Save iainmcgin/4980569 to your computer and use it in GitHub Desktop.
Save iainmcgin/4980569 to your computer and use it in GitHub Desktop.
Use of lazy views to prevent multiple transformations on a list.
val numbersAsStrings = Seq("1", "4", "5", "7", "8", "20", "10")
val ints = (numbersAsStrings.view map { _.toInt } filter {_ % 2 == 0}).force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment