code: private void recursivels(FileSystem fs, Path p, List<FileStatus> out) 
    throws IOException {
      FileStatus fstatus = fs.getFileStatus(p);
      if (!fstatus.isDir()) {
        out.add(fstatus);
        return;
      }
      else {
        out.add(fstatus);
        FileStatus[] listStatus = fs.listStatus(p);
        for (FileStatus stat: listStatus) {
          recursivels(fs, stat.getPath(), out);
        }
      }
    }
docs: this assumes that there are two types of files file/dir
  @param fs the input filesystem
  @param p the top level path
  @param out the list of paths output of recursive ls
  @throws IOException