mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-24 17:51:09 +07:00
20 lines
393 B
Java
20 lines
393 B
Java
// "Replace Stream API chain with loop" "true-preview"
|
|
|
|
import java.util.List;
|
|
import java.util.OptionalInt;
|
|
|
|
public class Main {
|
|
interface Index {
|
|
int asInteger();
|
|
}
|
|
interface IndexSet<S extends Index> {
|
|
List<S> asList();
|
|
}
|
|
|
|
public static OptionalInt min(IndexSet<?> set) {
|
|
return set.asList()
|
|
.<caret>stream()
|
|
.mapToInt(Index::asInteger)
|
|
.min();
|
|
}
|
|
} |