0

Im quite new to the new Java features and was wondering how I could convert this bit of code into a lambda expression?

tc.setCellValueFactory((p) -> {
            return new ReadOnlyStringWrapper(p.getValue());
});

This is what IntelliJ Idea IDE is giving me.

Thsi is

3
  • It's already a lambda, remove the return. Commented Nov 13, 2016 at 15:07
  • 1
    @Maroun-Maroun its a statement lambda but not a Expression Lambda Commented Nov 13, 2016 at 15:12
  • @janos the return at this place is optional. If used it must not generate any compilation errors, I'm I wrong ? Commented May 7, 2018 at 19:24

1 Answer 1

2

What your IDE means is likely:

(p) -> new ReadOnlyStringWrapper(p.getValue());

No return needed.

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.