List of usage examples for org.apache.commons.collections CollectionUtils predicatedCollection
public static Collection predicatedCollection(Collection collection, Predicate predicate)
From source file:com.google.mr4c.content.ContentTypes.java
public static Collection<String> filterByContentType(Collection<String> fileNames, final String contentType, final boolean canonicalOnly) { return CollectionUtils.predicatedCollection(fileNames, new Predicate() { public boolean evaluate(Object obj) { String name = (String) obj; if (canonicalOnly) { String suffix = ContentTypes.getSuffix(contentType); return FilenameUtils.isExtension(name, suffix); } else { Collection<String> suffixes = ContentTypes.getSuffixes(contentType); return FilenameUtils.isExtension(name, suffixes); }/* w ww. j a va 2 s. c om*/ } }); }