private File [ ] getFiles ( final File dir ) { final File [ ] files = dir . listFiles ( new FileFilter ( ) { @ Override public boolean accept ( final File file ) { final boolean pointFile = file . getName ( ) . startsWith ( "." ) ; final String extension = FilenameUtils . getExtension ( file . getName ( ) ) ; return ( ! pointFile && fileExtensions . contains ( extension ) ) || file . isDirectory ( ) ; } } ) ; return files ; }
Returns files that end with java and all directories . Files and directories started with a . are excluded .