code: public static <T> Collection<T> asCollection(Iterable<T> self) {
          if (self instanceof Collection) {
              return (Collection<T>) self;
          } else {
              return toList(self);
          }
      }
docs: Converts this Iterable to a Collection. Returns the original Iterable
  if it is already a Collection.
  <p>
  Example usage:
  <pre class="groovyTestCase">
  assert new HashSet().asCollection() instanceof Collection
  </pre>
  
  @param self an Iterable to be converted into a Collection
  @return a newly created List if this Iterable is not already a Collection
  @since 2.4.0