code: public static Collection collectNested(Iterable self, Collection collector, Closure transform) {
          for (Object item : self) {
              if (item instanceof Collection) {
                  Collection c = (Collection) item;
                  collector.add(collectNested((Iterable)c, createSimilarCollection(collector, c.size()), transform));
              } else {
                  collector.add(transform.call(item));
              }
              if (transform.getDirective() == Closure.DONE) {
                  break;
              }
          }
          return collector;
      }
docs: Recursively iterates through this Iterable transforming each non-Collection value
  into a new value using the <code>transform</code> closure. Returns a potentially nested
  collection of transformed values.
  <pre class="groovyTestCase">
  def x = [1,[2,3],[4],[]].collectNested(new Vector()) { it * 2 }
  assert x == [2,[4,6],[8],[]]
  assert x instanceof Vector
  </pre>
  
  @param self      an Iterable
  @param collector an initial Collection to which the transformed values are added
  @param transform the closure used to transform each element of the Iterable
  @return the collector with all transformed values added to it
  @since 2.2.0