/** * Checks if all categories are accepted. * * @param categories the categories to be accepted. * @return <code>true</code> if all categories are accepted, * <code>false</code> if at least one category is rejected. */ private boolean acceptsAllOf(final List<String> categories) { if (categories.isEmpty()) { return excludeCategories != ALL; // NOPMD } for (final String category : categories) { if (!acceptCategory(category)) { return false; } } return true; }
/** * Filters the list of categories to retain only those that are accepted by * {@link #acceptCategory(String)}. * * @param categories the category list to filter. * @return a copy of the given <code>categories</code> containing only those * categories that are accepted. */ public List<String> filterCategories(final List<String> categories) { if (categories == null) { return null; } if (excludeCategories != ALL && excludeCategories.isEmpty()) // NOPMD { return new ArrayList<String>(categories); } final List<String> copy = new ArrayList<String>(categories.size()); for (final String category : categories) { if (acceptCategory(category)) { copy.add(category); } } return copy; }