code: private RemoteIterator<LocatedFileStatus> arrayListing(final String src)
    throws IOException {
      return new RemoteIterator<LocatedFileStatus>() {
        private FileStatus[] stats;
        private int i = 0;
  
        { //initializer
          stats = listPaths(src);
          if (stats == null) {
            throw new FileNotFoundException("File " + src + " does not exist.");
          }
        }
  
        @Override
        public boolean hasNext() throws IOException {
          return i<stats.length;
        }
  
        @Override
        public LocatedFileStatus next() throws IOException {
          if (!hasNext()) {
            throw new NoSuchElementException("No more entry in " + src);
          }
          FileStatus result = stats[i++];
          BlockLocation[] locs = result.isDir() ? null :
              getBlockLocations(
                  result.getPath().toUri().getPath(), 0, result.getLen());
          return new LocatedFileStatus(result, locs);
        }
      };
    }
docs: create the iterator from an array of file status