mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-11 20:07:01 +07:00
19 lines
387 B
Java
19 lines
387 B
Java
// "Replace Optional.isPresent() condition with functional style expression" "true"
|
|
|
|
import java.util.*;
|
|
|
|
public class Main {
|
|
public void testOptional(Optional<String> str) {
|
|
String val;
|
|
if (str.isPrese<caret>nt()) {
|
|
val = str.get().trim();
|
|
} else {
|
|
val = getDefault();
|
|
}
|
|
System.out.println(val);
|
|
}
|
|
|
|
public String getDefault() {
|
|
return "";
|
|
}
|
|
} |