enumerate< T> function 
    Returns a Stream of IndexedValues where the nth value holds the nth
element of stream and its index.
Implementation
Stream<IndexedValue<T>> enumerate<T>(Stream<T> stream) {
  var index = 0;
  return stream.map((value) => new IndexedValue<T>(index++, value));
}