mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-11 11:36:59 +07:00
15 lines
301 B
Java
15 lines
301 B
Java
// "Use 'orElseGet' method with functional argument" "false"
|
|
|
|
import java.util.Optional;
|
|
|
|
class Test {
|
|
String createDefaultString(int x) {
|
|
return "foo"+x;
|
|
}
|
|
|
|
public void test(Optional<String> opt) {
|
|
int x = 5;
|
|
x++;
|
|
String result = opt.orElse(createDef<caret>aultString(x));
|
|
}
|
|
} |