/** * Item filter that discard items for which no feature data is available. * * @param <U> type of the users * @param <I> type of the items * @param <F> type of the features * @param featureData feature data * @return item filters that return true when there is any feature information for the item */ public static <U, I, F> Function<U, Predicate<I>> withFeatures(FeatureData<I, F, ?> featureData) { Set<I> itemsWithFeatures = featureData.getItemsWithFeatures().collect(Collectors.toSet()); return user -> itemsWithFeatures::contains; }