code: @NullSafe
    @SuppressWarnings("unchecked")
    public static <T> T[] asArray(Iterable<T> iterable, Class<T> componentType) {
  
      List<T> arrayList = new ArrayList<>();
  
      for (T element : CollectionUtils.nullSafeIterable(iterable)) {
        arrayList.add(element);
      }
  
      return arrayList.toArray((T[]) Array.newInstance(defaultIfNull(componentType, Object.class), arrayList.size()));
    }
docs: Converts the {@link Iterable} into an array.
  
  @param <T> Class type of the elements in the {@link Iterable}.
  @param iterable {@link Iterable} collection to convert into an array.
  @param componentType {@link Class} type of the elements in the {@link Iterable}.
  @return an array containing all the elements from the {@link Iterable} collection.  Returns an empty array
  if the {@link Iterable} is null or empty.
  @see java.lang.Class
  @see java.lang.Iterable