Functional interfaces in Kotlin
Jul 7, 2017
1 minute read

In Java we write functional interfaces to be able to use lambdas:

public interface Predicate<T> {
    boolean test(T t);

In Kotlin you will realize that SAM (SingleAbstractMethod) interfaces do not allow you to use Kotlin closures.

Typealiases to the rescue:

typealias Predicate<T> = (T) -> Boolean