Last active
August 29, 2015 14:25
-
-
Save joecwu/979b5b096ac03e7f31dc to your computer and use it in GitHub Desktop.
Blog - Scala API Document Example Code http://blog.joecwu.com/2015/07/scava-scala-scala-api-document-function.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val list=List(1,2,3,4,5) | |
//list: List[Int] = List(1, 2, 3, 4, 5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val oddFilter= (x:Int)=>x%2==1 | |
//oddFilter: Int => Boolean = <function1> | |
list.filter(oddFilter) | |
//res0: List[Int] = List(1, 3, 5) | |
list.filter(x=>x%2==1) | |
//res1: List[Int] = List(1, 3, 5) | |
list.filter{ x=> | |
x%2==1 | |
} | |
//res2: List[Int] = List(1, 3, 5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment