Files
Tagir Valeev db403ae8ed ConditionalCanBeOptionalInspection
Fixes IDEA-179273 Nullability check can be simplified when return type is Optional
2018-01-23 17:59:38 +07:00

13 lines
277 B
Java

// "Replace with Optional.ofNullable() chain" "GENERIC_ERROR_OR_WARNING"
import java.util.Optional;
class Test {
String getDefault() {
return "";
}
String select(String foo) {
return Optional.ofNullable(foo).map(String::trim).orElseGet(this::getDefault);
}
}