import java.util.List; import java.util.stream.Collectors; public class FluentCollectionExample { public static void main(String[] args) { List<Integer> numbers = List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); List<Integer> evenSquares = FluentCollection.from(numbers) .filter(n -> n % 2 == 0) .map(n -> n * n) .collect(Collectors.toList()); System.out.println(evenSquares); } }


上一篇:
下一篇:
切换中文