code: public static <T> T[] toArray(Collection<T> col, Class<T> cls)
      {
          T[] arr = (T[]) Array.newInstance(cls, col.size());
          return col.toArray(arr);
      }
docs: Converts Collection to array.
  @param <T>
  @param col
  @param cls
  @return
  @see java.util.Collection#toArray(T[])