All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.aksw.commons.collections.FileDescender Maven / Gradle / Ivy

There is a newer version: 0.9.9
Show newest version
package org.aksw.commons.collections;

import java.io.File;
import java.io.FileFilter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;

/**
 * @author Claus Stadler
 *         

* Date: 8/12/11 * Time: 5:17 PM */ public class FileDescender implements Descender { private FileFilter filter; public FileDescender() { this.filter = new FileFilter() { public boolean accept(File pathname) { return true; }}; } public FileDescender(FileFilter filter) { this.filter = filter; } @SuppressWarnings("unchecked") public Collection getDescendCollection(File item) { if(item == null || !item.isDirectory()) { return new ArrayList(); } File[] files = filter != null ? item.listFiles(filter) : item.listFiles(); Collection tmp = files == null ? Collections.emptyList() : Arrays.asList(files); //System.out.println(tmp); return new ArrayList(tmp); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy