Converts a List to an array

@param type   the Class type of the elements of the List
@param values the List to convert
@return the array
510377
public static Object convertToArray(final Class type, final List<?> values) {
        final Object exampleArray = Array.newInstance(type, values.size());
        try {
            return values.toArray((Object[]) exampleArray);
        } catch (ClassCastException e) {
            for (int i = 0; i < values.size(); i++) {
                Array.set(exampleArray, i, values.get(i));
            }
            return exampleArray;
        }
    }
41408
public static <T> T[] toArray(List<T> list) {
        T[] toR = (T[]) Array.newInstance(list.get(0).getClass(), list.size());
        for (int i = 0; i < list.size(); i++) {
            toR[i] = list.get(i);
        }
        return toR;
    }
1245889
@SafeVarargs
	public static <T> List<T> list(boolean isLinked, T... values) {
		if (ArrayUtil.isEmpty(values)) {
			return list(isLinked);
		}
		List<T> arrayList = isLinked ? new LinkedList<T>() : new ArrayList<T>(values.length);
		for (T t : values) {
			arrayList.add(t);
		}
		return arrayList;
	}
990851
static String[] listToArray(List<String> elements, String defaultValue){
        if (elements == null || elements.isEmpty()) return new String[]{defaultValue};

        String[] elementsArr = new String[elements.size()];
        elements.toArray(elementsArr);

        return elementsArr;
    }
392679
private static double[] toArray(List<Double> list) {
    double[] values = new double[list.size()];
    for (int i = 0; i < values.length; i++) {
      values[i] = list.get(i);
    }
    return values;
  }
56183
def values_to_array(input_values):
    '''
    
    '''
    if type(input_values)==tuple:
        values = np.array(input_values).reshape(-1,1)
    elif type(input_values) == np.ndarray:
        values = np.atleast_2d(input_values)
    elif type(input_values)==int or type(input_values)==float or type(np.int64):
        values = np.atleast_2d(np.array(input_values))
    else:
        print('Type to transform not recognized')
    return values
1183801
@SuppressWarnings({ "unchecked", "rawtypes" })
	public static List<Object> arrayAsList(Object value) {
		if (value instanceof List) {
			return (List<Object>) value;
		}
		List list = null;
		if (value instanceof int[]) {
			list = new ArrayList();
			int[] array = (int[]) value;
			for (int i : array) {
				list.add(i);
			}
		} else if (value instanceof short[]) {
			list = new ArrayList();
			short[] array = (short[]) value;
			for (short i : array) {
				list.add(i);
			}
		} else if (value instanceof char[]) {
			list = new ArrayList();
			char[] array = (char[]) value;
			for (char i : array) {
				list.add(i);
			}
		} else if (value instanceof byte[]) {
			list = new ArrayList();
			byte[] array = (byte[]) value;
			for (byte i : array) {
				list.add(i);
			}
		} else if (value instanceof long[]) {
			list = new ArrayList();
			long[] array = (long[]) value;
			for (long i : array) {
				list.add(i);
			}
		} else if (value instanceof double[]) {
			list = new ArrayList();
			double[] array = (double[]) value;
			for (double i : array) {
				list.add(i);
			}
		} else if (value instanceof float[]) {
			list = new ArrayList();
			float[] array = (float[]) value;
			for (float i : array) {
				list.add(i);
			}
		} else if (value instanceof boolean[]) {
			list = new ArrayList();
			boolean[] array = (boolean[]) value;
			for (boolean i : array) {
				list.add(i);
			}
		} else if (value.getClass().isArray()) {
			Object[] array = (Object[]) value;
			list = Arrays.asList(array);
		}
		return list;
	}
842902
private <T> List<T> asList(Object value, Class<T> ofClass) {
        @SuppressWarnings("unchecked")
        T[] values = (T[]) value;
        return Arrays.asList(values);
    }
288068
private static JsonArray toJsonArray(Collection<String> values) {
        JsonArray array = new JsonArray();
        for (String value : values) {
            array.add(value);
        }
        return array;

    }
53243
<T extends ListValue> Collection<T> getListTypeValues(Class<T> valuesClass) {
        return instance.get().listTypeValues(valuesClass);
    }
14920
synchronized public Object[] toArray(Object[] values) {
    int count = 0;
    for (int bind = 0; bind < buckets.length; bind++) {
      if (counts[bind] > 0)
         System.arraycopy(buckets[bind], 0, values, count, counts[bind]);
      count += counts[bind];
    }
    return values;
  }
808649
@SuppressWarnings("unchecked")
    public static <E> E[] toArray(final List<E> list) {
        E[] array = null;
        if (list != null && list.size() > 0) {
            array = (E[]) Array.newInstance(list.get(0).getClass(), list.size());
            for (int i = 0; i < list.size(); i++) {
                if (list.get(i) != null) {
                    array[i] = list.get(i);
                } else {
                    array[i] = null;
                }
            }
        }
        return array;
    }
551838
public R toBytesArray(@Nullable Iterable<ByteArray> values) {
    return handle(Value.bytesArray(values));
  }
768477
public R toInt64Array(@Nullable Iterable<Long> values) {
    return handle(Value.int64Array(values));
  }
1271031
public static UInteger[] uint_a(int... values) {
        UInteger[] array = new UInteger[values.length];
        for (int i = 0; i < values.length; i++) {
            array[i] = uint(values[i]);
        }
        return array;
    }
844003
public static final <T> Function<T,T[]> intoSingletonArrayOf(final Type<T> type) {
        return new IntoSingletonArray<T>(type);
    }
1276359
public static <T extends Enum<T>> String[] enumNameToStringArray(T[] values) {

        int i = 0;
        String[] result = new String[values.length];
        for (T value : values) {
            result[i++] = value.name();
        }
        return result;
    }