mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-28 21:30:23 +07:00
Merge-request: IJ-MR-174003 Merged-by: Bartek Pacia <bartek.pacia@jetbrains.com> GitOrigin-RevId: 11262e4d6da8be5a8ebd664c4415d8b812f12b6e
24 lines
664 B
Java
24 lines
664 B
Java
import org.jetbrains.annotations.NotNullByDefault;
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
|
|
@NotNullByDefault
|
|
class Test {
|
|
private static void processList(List<Integer> list) {
|
|
Integer result = list.stream()
|
|
.<@Nullable Integer>map(x -> x) // We want to prevent the 'redundant map operation' warning on this line
|
|
.reduce(null, (a, b) -> a == null ? b : Math.max(a, b));
|
|
if (result != null) {
|
|
System.out.println(result);
|
|
}
|
|
else {
|
|
System.out.println("empty");
|
|
}
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
processList(Arrays.asList(1, 2, 3, 4, 5, 1, 2));
|
|
}
|
|
} |