create the iterator from an array of file status
171191
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);
      }
    };
  }
1258449
function iterator(obj, iteratee, memo, keys, index, length) {
                  for (; index >= 0 && index < length; index += dir) {
                    var currentKey = keys ? keys[index] : index;
                    memo = iteratee(memo, obj[currentKey], currentKey, obj);
                  }
                  return memo;
                }
759125
public Arr array(File[] files, int start, int count) {
		return Arr.fromList(list(files, start, count));
	}
538254
function iterateRecurse (dir, options, cb) {
  try {
    var files = fs.readdirSync(dir)
    files.forEach(function (file, index) {
      var parsedPath = path.parse(file)
      var name = parsedPath.name
      var ext = parsedPath.ext
      var srcpath = path.join(dir, file)

      if (options.skip_ && name.charAt(0) === '_') {
        logger.debug('Skipping file/folder: ' + srcpath)
      } else {
        if (fs.lstatSync(srcpath).isDirectory()) {
          if (options.dirs) {
            cb(srcpath, name)
          }

          // Do recursive search when needed
          if (options.recursive) {
            iterateRecurse(srcpath, options, cb)
          }
        } else {
          for (var i = 0; i < options.ext.length; i++) {
            if (ext === options.ext[i]) {
              cb(srcpath, name, ext)
            }
          }
        }
      }
    })
  } catch (e) {
    logger.debug('Error iterating files: ' + e)
  }
}
464806
def status(iteration, elapsed_time)
      file.write("\r" + padded_line(iteration, elapsed_time))
      file.flush
    end
1118659
function(arr, iterator) {
  var i = arr.length - 1, index = null

  if(i >= 0){
    do {
      if(iterator(arr[i])) {
        index = i
        break
      }
    } while(i--)
  }

  return index
}
1298973
@Override
  public Iterator<Reader> iterator() {
    Collection<Object> newCollection = new ArrayList<Object>();
    for (Object o : c) {
      if (o instanceof Reader) {
        String name = o.toString()+".tmp";
        File tmpFile;
        try {
          tmpFile = File.createTempFile(name,"");
        } catch (Exception e) {
          throw new RuntimeException(e.getMessage());
        }
        tmpFile.deleteOnExit();
        StringUtils.printToFile(tmpFile, IOUtils.slurpReader((Reader)o),
                                false, false, enc);
        newCollection.add(tmpFile);
      } else {
        newCollection.add(o);
      }
    }
    c = newCollection;
    return new ReaderIterator();
  }
1150105
function createArrayIterator(array, kind) {
  var object = toObject(array);
  var iterator = new ArrayIterator;
  iterator.iteratorObject_ = object;
  iterator.arrayIteratorNextIndex_ = 0;
  iterator.arrayIterationKind_ = kind;
  return iterator;
}
765448
function asyncMap(array, iterator, done) {
  if (!array || !array.length) {
    return done(null, [])
  }

  var error
    , out = []
    , todo = array.length

  array.forEach(exec)

  function exec(item) {
    process.nextTick(function tick() {
      iterator(item, add)
    })
  }

  function add(err, data) {
    if (error) {
      return
    }
    else if (err) {
      error = true
      return done(err)
    }

    out.push(data)

    if (--todo === 0) {
      done(null, out)
    }
  }
}
632173
def iter_tree(jottapath, JFS):
    """"""
    filedirlist = JFS.getObject('%s?mode=list' % jottapath)
    log.debug("got tree: %s", filedirlist)
    if not isinstance(filedirlist, JFSFileDirList):
        yield ( '', tuple(), tuple() )
    for path in filedirlist.tree:
        yield path
859209
def poll(self, force_rescan = False):
      """"""
      # Check for new, deleted, and rotated files.
      if force_rescan or time.time() > self._last_scan + self._interval:
         self._rescan(skip_to_end = False)
         self._last_scan = time.time()

      filereaders = {}
      for path, tailedfile in self._tailedfiles.iteritems():
         filereaders[path] = tailedfile.readlines()

      # One line is read from each file in turn, in an attempt to read
      # from all files evenly. They'll be in an undefined order because
      # of using a dict for filereaders, but that's not a problem
      # because some entropy here is desirable for evenness.
      while len(filereaders) > 0:
         for path in filereaders.keys():
            lines = filereaders[path]
            try:
               line, offset = lines.next()
            except StopIteration:
               # Reached end the of this file.
               del filereaders[path]
               break
            
            yield (path, offset), line
879714
function Iterator() {
    var items = Array.prototype.slice.call(arguments, 0);

    this.items = (items.length == 1 && Array.isArray(items[0])) ? items[0] : items;
    this.reset();
}
102303
def variable_outfile_iterator(outfiles, infiles, arggroups, engine):
    """"""
    assert len(outfiles) == 1

    template = engine(outfiles[0], tolerant=False)

    for infile in infiles:
        properties = make_path_properties(infile, prefix='')

        for arggroup in arggroups:
            outfile = template.apply(dict(arggroup, **properties))
            yield (outfile, infile, arggroup)
411608
def iter(self):
        
        for _file in self._files:
            with asHandle(_file) as fp:
                # Use FastqGeneralIterator because it provides access to
                # the unconverted quality string (i.e., it doesn't try to
                # figure out the numeric quality values, which we don't
                # care about at this point).
                for sequenceId, sequence, quality in FastqGeneralIterator(fp):
                    yield self.readClass(sequenceId, sequence, quality)
804342
function arraySort (arr, iterate, context, STR_UNDEFINED) {
  if (arr) {
    if (iterate === STR_UNDEFINED) {
      return toArray(arr).sort(sortByDef)
    }
    var compares
    var list = arrayMap(arr, function (item) {
      return { data: item }
    })
    var sortPros = getSortPros(arr, list, iterate, context || this)
    var len = sortPros.length
    if (len) {
      while (len >= 0) {
        compares = sortMultis(len, compares)
        len--
      }
      list = list.sort(compares)
    }
    return arrayMap(list, baseExports.property('data'))
  }
  return []
}
540553
function pipeFileArray (arr) {
    testPipeFile();

    // Just end WriteStream if no files need to be read to keep default pipe behavior.
    if (arr.length === 0) {
        writable.end();
    } else {
        iterateData.collection = arr;

        iteratePipeFile();
    }
}
366396
def filer(filelist):
    
    # Initialise the dictionary
    filedict = dict()
    for seqfile in filelist:
        # Split off the file extension and remove the path from the name
        strainname = os.path.splitext(os.path.basename(seqfile))[0]
        # Populate the dictionary
        filedict[strainname] = seqfile
    return filedict