Extensão de arquivo

Postado: 24 de setembro de 2011 by fabiojapa in gohorse, pog, xgh - gohorse
Tags: ,
    /**
     * aonde ele aprendeu isso?
     * @see java.io.FileFilter#accept(File)
     */
    public boolean accept(File file) {
       if (filename.getName().substring((filename.getName().length() - 4), filename.getName().length()).compareTo(EXTENSAO) == 1) {
          return true;
       } else {
          return false;
       }
    }  

    /**
     * Que tal fazer assim?
     * @see java.io.FileFilter#accept(File)
     */
    public boolean accept(File file) {
       String filename = file.getName();
       return filename.endsWith(EXTENSAO)
    }