findFirstは1個目の要素が保証される
findAnyは1個目の要素が保証されない
public class Outer {
public static void main(String[] args) {
List<Integer> l = List.of(1,2,3,4,5);
l.parallelStream().findAny().ifPresent(System.out::println);
l.parallelStream().findFirst().ifPresent(System.out::println);
}
}
3
1