Returns an iterable over Index objects that each hold one of the original
objects of the stream as well its index in the stream
166614
public static <T> Iterable<Indexed<T>> enumerate(Iterable<T> stream) {
        return new Iterable<Indexed<T>>() {

            @Override
            public Iterator<Indexed<T>> iterator() {
                Iterator<T> itr = stream.iterator();
                return new Iterator<Indexed<T>>() {

                    private int i = 0;

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

                    @Override
                    public Indexed<T> next() {
                        Indexed<T> nextPair = new Indexed<T>(itr.next(), i);
                        i++;
                        return nextPair;
                    }
                };
            }
        };
    }
1099780
public Iterable<String> get(String index, String... keys) {
        return get(index, Arrays.asList(keys));
    }
735510
def peek_at(iterable: Iterable[T]) -> Tuple[T, Iterator[T]]:
    
    gen = iter(iterable)
    peek = next(gen)
    return peek, itertools.chain([peek], gen)
1225913
def get_objects(self):
        """"""
        return rope.base.oi.soi.get_passed_objects(
            self.pyfunction, self.index)
149337
function forOwn(object, iteratee) {
    Object.keys(object).forEach(function (key) { return iteratee(object[key], key, object); });
}
1089431
def get_indexes(self):
        
        ret = {}
        for index in self.iter_query_indexes():
            ret[index.name] = index
        return ret
486577
public Collection<E> internAll(@NonNull Iterable<? extends E> iterable) {
      return asStream(iterable).map(this::intern).collect(Collectors.toList());
   }
506840
def copy(self):
		""""""
		ret = IndexedDict()
		ret._dict = self._dict.copy()
		ret._list = list(self._list)
		return ret
889662
public static <R> Stream<R> of(Iterable<R> iterable) {
        return new Stream<R>(iterable.iterator());
    }
924213
def load_stream(self, stream):
        
        # load the batches
        for batch in self.serializer.load_stream(stream):
            yield batch

        # load the batch order indices
        num = read_int(stream)
        batch_order = []
        for i in xrange(num):
            index = read_int(stream)
            batch_order.append(index)
        yield batch_order
504231
public static <T> ImmutableMap<T, Integer> indexMap(Iterable<? extends T> items) {
    final ImmutableMap.Builder<T, Integer> ret = ImmutableMap.builder();
    int idx = 0;
    for (final T item : items) {
      ret.put(item, idx++);
    }
    return ret.build();
  }
741119
def _make_chunk_iter(stream, limit, buffer_size):
    """"""
    if isinstance(stream, (bytes, bytearray, text_type)):
        raise TypeError('Passed a string or byte object instead of '
                        'true iterator or stream.')
    if not hasattr(stream, 'read'):
        for item in stream:
            if item:
                yield item
        return
    if not isinstance(stream, LimitedStream) and limit is not None:
        stream = LimitedStream(stream, limit)
    _read = stream.read
    while 1:
        item = _read(buffer_size)
        if not item:
            break
        yield item
727403
def to_list(obj):
    
    obj = to_iter(obj)

    if isinstance(obj, type(None)):
        return None
    else:
        return list(obj)
496409
def readList(self):
        
        obj = []
        self.context.addObject(obj)
        l = self.stream.read_ulong()

        for i in xrange(l):
            obj.append(self.readElement())

        return obj
577155
def from_params(cls, params):
        
        key_fn = lambda x: id(x[1].owner)
        streams = []
        for _, group in groupby(sorted(params.items(), key=key_fn), key_fn):
            group = list(group)
            inst = [p.owner for _, p in group][0]
            if not isinstance(inst, param.Parameterized):
                continue
            names = [p.name for _, p in group]
            rename = {p.name: n for n, p in group}
            streams.append(cls(inst, names, rename=rename))
        return streams
182257
def items(self):
        
        temp = self.clone()
        return [(f, getattr(temp, f)) for f in iter(self)]
1279742
@Override
	public List<E> collect() {
		try (Stream<E> stream = stream()) {
			return stream.collect(Collectors.toList());
		}
	}