Skip to content

Instantly share code, notes, and snippets.

@adam-arold
Created September 11, 2017 16:37
Show Gist options
  • Save adam-arold/392370158e68247cddf7585cee92575b to your computer and use it in GitHub Desktop.
Save adam-arold/392370158e68247cddf7585cee92575b to your computer and use it in GitHub Desktop.
KotlinFilterOperation
class KotlinFilterOperation {
private val items = listOf<String>()
fun filterBy(fn: (String) -> Boolean) = items.filter(fn)
fun doFilter() {
filterBy(String::isNotEmpty)
// note the exension function `isNotEmpty` added to `String`!
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment