mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-02 02:32:34 +07:00
for "Null check can be replaced with method call" inspection GitOrigin-RevId: ffa45cce88afb341cdeb9a49d4ee256251865bfc
20 lines
338 B
Java
20 lines
338 B
Java
// "Replace 'if' statement with 'Stream.ofNullable()' call" "true"
|
|
|
|
import java.util.*;
|
|
import java.util.stream.Stream;
|
|
|
|
class Other {
|
|
Object val = new Object();
|
|
|
|
}
|
|
|
|
class Test {
|
|
|
|
public Stream test(Other o) {
|
|
if<caret> (o.val == null) {
|
|
return Stream.empty();
|
|
} else {
|
|
return Stream.ofNullable(o.val);
|
|
}
|
|
}
|
|
} |