Lambda

Lambda, which can also be called anonymous functions, has a first-class citizen support in Kotlin. While, in Java, lambda is only supported starting with Java 8, in Kotlin, you can use Kotlin with JVM 6 onwards, so there's really no barrier for lambda in Kotlin.

Now, we were talking about lambda, anonymous classes (or objects) and anonymous functions, but what are they? Let us explore.

To be generic, lambda or lambda expressions generally means anonymous functions, that is, functions without names, which can be assigned to variables, passed as arguments, or returned from another function. It is a kind of nested function, but is more versatile and more flexible. You can also say all the lambda expressions are functions, but not every ...

Get Functional Kotlin now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.