Skip to content

Instantly share code, notes, and snippets.

@humblerookie
Last active July 17, 2020 10:15
Embed
What would you like to do?
Sample non lambda instantiation
fun oldInstantiation() {
val defaultParser = object : Parser{
override fun parse(value: String): ParsedOutput {
require(value.length > 4)
ParsedOutput(value.substring(0, 3), value.substring(3, value.length))
}
}
}
fun newInstantiation() {
val defaultParser = Parser { value ->
require(value.length > 4)
ParsedOutput(value.substring(0, 3), value.substring(3, value.length))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment