private List<BaseIcon> filterIconsToChangeByPositions(List<BaseIcon> baseIcons, List<Integer> positions) { return baseIcons.stream() .filter(baseIcon -> pred(positions)) .collect(Collectors.toList()); } private Predicate<BaseIcon> pred(List<Integer> positions) { return baseIcon -> positions.stream().anyMatch(pos -> pos == baseIcon.getPositionOnGameField()); } I can not understand why the data does not compile, since the type says that the lmbd has a bad type