// Prune itemsets from C(k+1) that violate downward closure private static List<Itemset> prune(List<Itemset> candidates, List<Itemset> frequentItemsets) { List<Itemset> prunedCandicates = new ArrayList<>(); for (Itemset candidate : candidates) { if (frequentItemsets.containsAll(candidate.downwardClosure())) { prunedCandicates.add(candidate); } } return prunedCandicates; }