June 2018
Intermediate to advanced
316 pages
6h 34m
English
In Kotlin, a lambda is a function that is decelerated without an identifier and the fun keyword, but with a certain type. Under the hood, a lambda is an object that has the Function<out R> type:
package kotlinpublic interface Function<out R>
A lambda can take a varying number of arguments. To cover as many cases as possible, the Functions.kt file was created. This file contains 22 interfaces that extend the Function<out R> interface:
package kotlin.jvm.functionspublic interface Function0<out R> : Function<R> { public operator fun invoke(): R}public interface Function1<in P1, out R> : Function<R> { public operator fun invoke(p1: P1): R}public interface Function2<in P1, in P2, out R> : Function<R> { public operator fun invoke(p1: P1, ...
Read now
Unlock full access