We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An expression lambda like s -> b.append("/").append(s) can't be converted to a method reference because b.append("/") has a side effect
s -> b.append("/").append(s)
b.append("/")
String a = null; StringBuilder b = new StringBuilder(); Optional.ofNullable(a).ifPresent(s -> b.append("/").append(s)); System.out.println(b);
Output:
↓↓↓
String a = null; StringBuilder b = new StringBuilder(); Optional.ofNullable(a).ifPresent(b.append("/")::append); System.out.println(b);
/
Seems safer to assume a call chain produces a side effect and give up on converting such a lambda expression to method reference.
The text was updated successfully, but these errors were encountered:
Fixed in #849
Sorry, something went wrong.
Bravo! 👏🏻
No branches or pull requests
An expression lambda like
s -> b.append("/").append(s)
can't be converted to a method reference becauseb.append("/")
has a side effectOutput:
↓↓↓
Output:
Seems safer to assume a call chain produces a side effect and give up on converting such a lambda expression to method reference.
The text was updated successfully, but these errors were encountered: