code: public static <T> Collection<T> eachWithIndex(Collection<T> self, @ClosureParams(value=FromString.class, options="T,Integer") Closure closure) {
          return (Collection<T>) eachWithIndex((Iterable<T>) self, closure);
      }
docs: Iterates through an Collection,
  passing each item and the item's index (a counter starting at
  zero) to the given closure.
  
  @param self    an Collection
  @param closure a Closure to operate on each item
  @return the self Collection
  @since 2.4.0