code: public static int size(Iterator self) {
          int count = 0;
          while (self.hasNext()) {
              self.next();
              count++;
          }
          return count;
      }
docs: Provide the standard Groovy <code>size()</code> method for <code>Iterator</code>.
  The iterator will become exhausted of elements after determining the size value.
  
  @param self an Iterator
  @return the length of the Iterator
  @since 1.5.5