code: public static <S,T> Collection<T> collect(Iterator<S> self, Collection<T> collector, @ClosureParams(FirstParam.FirstGenericType.class) Closure<? extends T> transform) {
          while (self.hasNext()) {
              collector.add(transform.call(self.next()));
          }
          return collector;
      }
docs: Iterates through this Iterator transforming each item into a new value using the <code>transform</code> closure
  and adding it to the supplied <code>collector</code>.
  
  @param self      an Iterator
  @param collector the Collection to which the transformed values are added
  @param transform the closure used to transform each item
  @return the collector with all transformed values added to it
  @since 2.5.0