Fluxos em Java, não consigo descobrir esse código
Encontrei o seguinte trecho de código:
Function<Integer, Predicate<Integer>> smallerThan = x -> y -> y < x;
List<Integer> l = Arrays.asList(5, 6, 7, 23, 4, 5645,
6, 1223, 44453, 60182, 2836, 23993, 1);
List<Integer> list2 = l.stream()
.filter(smallerThan.apply(l.get(0)))
.collect(Collectors.toList());
System.out.println(list2);
Como saída, recebo:
[4, 1]
Como é quesmallerThan
função neste exemplo de trabalho, considerando que passamos apenas um parâmetrosmallerThan.apply(l.get(0))
?