public static ImmutableList < Path > listFiles ( Path dir ) throws IOException { try ( DirectoryStream < Path > stream = Files . newDirectoryStream ( dir ) ) { return ImmutableList . copyOf ( stream ) ; } catch ( DirectoryIteratorException e ) { throw e . getCause ( ) ; } }
Returns an immutable list of paths to the files contained in the given directory .