2
  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?

3
  • wrapper is a function, isn't it? If yes, it has no method getValue(). Is that code correct? Commented Oct 11, 2018 at 20:27
  • Did you find an answer? I'm wondering the same... Commented Sep 23, 2019 at 17:22
  • @IgorGanapolsky no I didn't Commented Nov 4, 2019 at 11:36

1 Answer 1

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

Note that objects is not used in your function.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.