Files
Andrey.Cherkasov 0d10ba565e [java] Fix test data files after inspection description updating
GitOrigin-RevId: faa9f564b7a37e4c1165c24f904994b951adfccd
2021-03-18 10:49:54 +00:00

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;
}
}