Skip to content

Instantly share code, notes, and snippets.

@sajjadyousefnia
Created December 14, 2018 15:22
Show Gist options
  • Save sajjadyousefnia/dc921bb20656d4c673c24fdd6ce399a2 to your computer and use it in GitHub Desktop.
Save sajjadyousefnia/dc921bb20656d4c673c24fdd6ce399a2 to your computer and use it in GitHub Desktop.
inline fun inlinedFilter(list : List<Int>, predicate : (Int) -> Boolean) : List<Int>{
return list.filter(predicate)
}
fun filterLessThanTwo(input: Int) = input < 2
fun lambdaInstance(predicate: (Int) -> Boolean) {
val list = listOf(1,2,3)
val newList = inlinedFilter(list, predicate)
println(newList)
}
fun lambdaInstanceTest() {
lambdaInstance(::filterLessThanTwo)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment