DaniloDeQueiroz
DaniloDeQueiroz

Reputation: 412

Converting Java lambda to kotlin

  public static Function<List<Object>, Function> required = objects -> (Function<FunctionKeeper, Object>) (wrapper) -> {
    if (LIVRUtils.isNoValue(wrapper.getValue())) {
        return "REQUIRED";
    }
    return "";
};

How do I convert this Java8 lambda approach to Kotlin lambda?

Upvotes: 2

Views: 575

Answers (1)

clemp6r
clemp6r

Reputation: 3723

val required = { objects: List<Any> ->
    { wrapper: FunctionKeeper ->
        if (LIVRUtils.isNoValue(wrapper.value)) {
            "REQUIRED"
        } else {
            ""
        }
    }
}

Note that objects is not used in your function.

Upvotes: 1

Related Questions