public String[] list(FilenameFilter filter)
Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter. The behavior of this method is the same as that of the list() method, except that the strings in the returned array must satisfy the filter. If the given filter is null then all names are accepted. Otherwise, a name satisfies the filter if and only if the value true results when the FilenameFilter.accept(java.io.File, java.lang.String) method of the filter is invoked on this abstract pathname and the name of a file or directory in the directory that it denotes.File的list方法中会调用accept方法

解决方案 »

  1.   

    在File.list(FilenameFilter obj)中,obj 会调用accept()函数。
      

  2.   

    这是接口FilenameFilter 中已经实现了的函数,现在只是需要填充这个函数,实现你需要的功能而已
      

  3.   

    public String[] list(FilenameFilter filter) {
    String names[] = list();
    if ((names == null) || (filter == null)) {
        return names;
    }
    ArrayList v = new ArrayList();
    for (int i = 0 ; i < names.length ; i++) {
        if (filter.accept(this, names[i])) {
    v.add(names[i]);
        }
    }
    return (String[])(v.toArray(new String[0]));
        }方法中的this指的是什么???
      

  4.   

    麻烦再问一下那就是指File这个类了??