mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 11:00:04 +07:00
Fixes IDEA-179273 Nullability check can be simplified when return type is Optional
13 lines
297 B
Java
13 lines
297 B
Java
// "Replace with Optional.ofNullable() chain (may change semantics)" "INFORMATION"
|
|
|
|
import java.util.Optional;
|
|
|
|
class Test {
|
|
String trim(String s) {
|
|
return s.isEmpty() ? null : s.trim();
|
|
}
|
|
|
|
String select(String foo) {
|
|
return Optional.ofNullable(foo).map(this::trim).orElse("");
|
|
}
|
|
} |