1 package find; 2 3 import version.Version; 4 import list.ListFile; 5 6 import java.util.Collection ; 7 import java.util.ArrayList ; 8 import java.io.File ; 9 10 import org.apache.commons.collections.CollectionUtils; 11 import org.apache.commons.collections.Predicate; 12 13 public class FindFile { 14 static { 15 Version.register("find"); 16 } 17 18 public static Collection find(File dir, String name) { 19 return find(ListFile.list(dir), name); 20 } 21 22 private static Collection find(Collection files, final String name) { 23 return CollectionUtils.select(files, new Predicate() { 24 public boolean evaluate(Object o) { 25 return ((File)o).getName().indexOf(name) != -1; 26 } 27 }); 28 } 29 } 30 | Popular Tags |