목차

필터링과 슬라이싱

프레디케이트로 필터링

List<Dish> vegetarianMenu =
                menu.stream()
                      .filter(Dish::isVegetarian)
                      .collect(toList());

http://drive.google.com/uc?export=view&id=0ByLqiEM75qEzeDBOdjkzekZKdTA

프레디케이트로 필터링

고유 요소 필터링

List<Integer> numbers = Arrays.asList(1, 2 ,1, 3, 3, 2, 4);
numbers.stream().filter (i -> i % 2 == 0)
                .distinct()
                .forEach(System.out::println);

http://drive.google.com/uc?export=view&id=0ByLqiEM75qEzd2pqQWtKalp4Smc

고유 요소 필터링

스트림 축소

List<Dish> dishes = menu.stream()
                            .filter(d -> d.getCalories() > 300)
                            .limit(3)
                            .collect(toList());

http://drive.google.com/uc?export=view&id=0ByLqiEM75qEzcXFDcHBoZUtiYTg

스트림 축소

요소 건너뛰기