public static List<FileStatus> filterFileStatuses(Iterator<FileStatus> input,
    FileStatusFilter filter) {
    if (input == null) return null;
    ArrayList<FileStatus> results = new ArrayList<>();
    while (input.hasNext()) {
      FileStatus f = input.next();
      if (filter.accept(f)) {
        results.add(f);
      }
    }
    return results;
  }
Filters FileStatuses in an iterator and returns a list
@param input  An iterator of FileStatuses
@param filter A required filter to filter the array
@return A list of FileStatuses
hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java