Cannot understand why this method is unresolved Cannot understand why this method is unresolved spring spring

Cannot understand why this method is unresolved


It looks like this book just contains an error, it does not list the filterByType() method. It's not a Spring method. Here you go:

private List<Ingredient> filterByType(List<Ingredient> ingredients, Type type) {    return ingredients.stream()            .filter(x -> x.getType().equals(type))            .collect(Collectors.toList());}

Source: Manning Publications


If you do not prefer readability:

  Arrays.stream(types).forEach(a -> model.addAttribute(a.toString().toLowerCase(Locale.ROOT), ingredients.stream().filter(i -> a.equals(i.getType())).collect(Collectors.toList())));