Skip to content

Instantly share code, notes, and snippets.

@sajjadyousefnia
Created December 13, 2018 14:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sajjadyousefnia/e5ccf8a088ce85d25783444dd53d7bf8 to your computer and use it in GitHub Desktop.
Save sajjadyousefnia/e5ccf8a088ce85d25783444dd53d7bf8 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 functionReferenceTest() {
val list = listOf(1,2,3)
val newList = inlinedFilter(list, ::filterLessThanTwo)
println(newList)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment