the list iterator in its state.
183250
private static boolean peek(ListIterator<Segment> segments, SegmentKind... kinds) {
    int start = segments.nextIndex();
    boolean success = false;
    for (SegmentKind kind : kinds) {
      if (!segments.hasNext() || segments.next().kind() != kind) {
        success = false;
        break;
      }
    }
    if (success) {
      return true;
    }
    restore(segments, start);
    return false;
  }
486782
@Override
    public Iterator<String> iterator() {
        this.reset();
        Iterator<String> ret = new Iterator<String>() {
            @Override
            public boolean hasNext() {
                return BasicLineIterator.this.hasNext();
            }

            @Override
            public String next() {
                return BasicLineIterator.this.nextSentence();
            }

            @Override
            public void remove() {
                throw new UnsupportedOperationException();
            }
        };

        return ret;
    }
1203998
def iterable(target):
    '''  '''
    if any(i in ('next', '__next__', '__iter__') for i in dir(target)):
        return True
    else:
        try:
            iter(target)
            return True
        except:
            return False
1332830
@Override
    public Iterator<Object> iterator() {
        return new Iterator<Object>() {
            Iterator<Object> iter = list.listIterator();

            @Override
            public boolean hasNext() {
                return iter.hasNext();
            }

            @Override
            public Object next() {
                return iter.next();
            }

            @Override
            public void remove() {
                iter.remove();
            }
        };
    }
488530
def as_list(self):
        
        if hasattr(self, 'cust_list'):
            return self.cust_list
        if hasattr(self, 'attr_check'):
            self.attr_check()
        cls_bltns = set(dir(self.__class__))
        ret = [a for a in dir(self) if a not in cls_bltns and getattr(self, a)]
        return ret
1014291
public Iterator<T> iterator() {

        if (input == null)
            return null;

        if (outputIterator == null)
            outputIterator = new SinkIterator<T>(input.iterator());

        return outputIterator;
    }
116576
def iterlists(self):
        """"""
        for key, values in dict.iteritems(self):
            yield key, list(values)
1266254
def this_and_prev(iterable):
    """"""
    try:
        item = next(iterable)
        while True:
            next_item = next(iterable)
            yield item, next_item
            item = next_item
    except StopIteration:
        return
744336
def List(self):
        
        print()
        for key in list(self.keys()):
            print(key,'=',self[key])
        print()
61915
function iterator(state, tasks, callback)
{
  var keys
    , tasksLeft = tasks.length
    , task      = tasks.shift()
    ;

  if (tasksLeft === 0)
  {
    return callback(null, state);
  }

  // init current task reference
  state._currentTask = {waiters: {}};

  if (typeOf(task) == 'object')
  {
    // update state with new options
    // to make it available for all the subcommands
    if (typeOf(task.options) == 'object')
    {
      state.options = extend(state.options || {}, task.options);

      // no need to process it further
      delete task.options;
    }

    // generate list of properties to update
    keys = Object.keys(task);
  }

  // convert non-array and non-object elements
  // into single element arrays
  if (typeof task != 'object')
  {
    task = [task];
  }

  execute(state, task, keys, function(err, modifiedState)
  {
    // reset current task
    // if it's error and modified state
    // isn't provided, use context
    (modifiedState || state)._currentTask = undefined; // eslint-disable-line no-undefined

    if (err) return callback(err);

    // proceed to the next element
    iterator(modifiedState, tasks, callback);
  });
}
1263515
def flat_list(lst):
    
    if isinstance(lst, list):
        for item in lst:
            for i in flat_list(item):
                yield i
    else:
        yield lst
512678
public Iterator iterator() {
        return new Iterator() {
            public boolean hasNext() {
                return false;
            }

            public Object next() {
                return null;
            }

            public void remove() {
                throw new UnsupportedOperationException();
            }
        };
    }
574164
function iter(list, func){
    for( var i = 0; i < list.length; i++ ){
	func(list[i], i);
    }
}
830892
def iterator(self):
        
        # FIXME: There is no dependency tracking; objects are iterated in
        #        random order.
        for ent_cls in list(self.__entity_set_map.keys()):
            for ent in self.__entity_set_map[ent_cls]:
                yield EntityState.get_state(ent)
219316
def iterator_from_slice(s):
    
    import numpy as np
    start = s.start if s.start is not None else 0
    step = s.step if s.step is not None else 1

    if s.stop is None:
        # Infinite iterator.
        return itertools.count(start=start, step=step)
    else:
        # xrange-like iterator that supports float.
        return iter(np.arange(start, s.stop, step))
451781
@Nonnull
  public Iterator <ICommonsList <String>> iterator ()
  {
    try
    {
      return new CSVIterator (this);
    }
    catch (final IOException e)
    {
      throw new UncheckedIOException ("Error creating CSVIterator", e);
    }
  }
677387
public static <T> List<T> asList(Iterator<T> itr) {
        List<T> l = new ArrayList<>();
        if (itr != null) {
            while (itr.hasNext()) {
                l.add(itr.next());
            }
        }
        return l;
    }