Code example for FileFilter

Methods: accept

0
    /** 
     * Accept file into collection if filter is null or passes.  
     * @return false only when !alwaysTrue and filter fails.  
     */ 
    public boolean accept(File f) {
        if ((null == filter) || filter.accept(f)) {
            add(f);
            return true; 
        } 
        return alwaysTrue;
    } 
 
    /** gather files */ 
    protected synchronized void add(File f) {
        if (null != f) {
            if (null == files) {
                files = new ArrayList();
            } 
            files.add(f);
        }