mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-27 22:20:54 +07:00
22 lines
557 B
Java
22 lines
557 B
Java
// "Replace Stream API chain with loop" "true-preview"
|
|
|
|
import java.util.*;
|
|
|
|
public class Main {
|
|
private static Optional<String> max(List<?> list) {
|
|
boolean seen = false;
|
|
String best = null;
|
|
for (Object o : list) {
|
|
if (o instanceof String[]) {
|
|
String[] x = (String[]) o;
|
|
String s = x[0];
|
|
if (!seen || s.compareTo(best) > 0) {
|
|
seen = true;
|
|
best = s;
|
|
}
|
|
}
|
|
}
|
|
return seen ? Optional.of(best) : Optional.empty();
|
|
}
|
|
}
|