class Lists {

  @SuppressWarnings("unchecked")
  public static <X> X[] toArray(List<X> inputs, Class<X> klazz) {
    if (null == inputs) {
      return (X[]) Array.newInstance(klazz, 0);
    }

    X[] out = inputs.toArray((X[]) Array.newInstance(klazz, inputs.size()));
    return out;
  }

  private  Lists();

}