mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-31 19:50:55 +07:00
26 lines
625 B
Java
26 lines
625 B
Java
// "Fix all ''Optional' can be replaced with sequence of 'if' statements' problems in file" "true"
|
|
|
|
import java.util.*;
|
|
|
|
class Test {
|
|
|
|
void inStatement(String in) {
|
|
String value = null;
|
|
if (in != null && in.length > 2) {
|
|
String ss = in.substring(3);
|
|
String strOrNull = getStrOrNull(ss);
|
|
if (strOrNull != null) value = strOrNull;
|
|
}
|
|
if (value == null) {
|
|
System.out.println("value is null");
|
|
} else {
|
|
System.out.println("found value %s", value);
|
|
}
|
|
}
|
|
|
|
|
|
private String getStrOrNull(String s) {
|
|
return s.length() > 2 ? s : null;
|
|
}
|
|
|
|
} |