code: public static <T> Object[] toArray(Iterable<T> iterable)
      {
          if (iterable == null)
          {
              throw new NullPointerException();
          }
          if (iterable instanceof Collection)
          {
              return ((Collection<T>) iterable).toArray();
          }
          if (iterable instanceof RichIterable)
          {
              return ((RichIterable<T>) iterable).toArray();
          }
          MutableList<T> result = Lists.mutable.empty();
          Iterate.addAllTo(iterable, result);
          return result.toArray();
      }
docs: Converts the specified iterable to an array.