Just like Java 8, Kotlin supports SAM conversions. This means that Kotlin function literals can be automatically converted into implementations of Java interfaces with a single non-default method, as long as the parameter types of the interface method match the parameter types of the Kotlin function.
SAM type conversions allow interfaces which require an implementation of a single method to accept either an anonymous class or a lambda.
In this screencast, we will do a recap on SAM Types, see how they work in Kotlin to support Java interoperability, and we'll also see some of the "gotchas" involved with the feature.
Basic knowledge or experience building Android applications is recommended.
For the More Curious...SAM Conversions
Transcripts are only available for subscribers. Create an account today to access our collection of screencasts, skill packs, and more.
Project files are only available for subscribers. Create an account today to access our collection of screencasts, skill packs, and more.