public static File [ ] filesContainedIn ( File source ) { if ( source . isDirectory ( ) ) { return source . listFiles ( ) ; } else { return new File [ ] { source } ; } }
Given a source File return its direct descendants if the File is a directory . Otherwise return the File itself .