Convert the given array to list

@param array the array
@param clazz the type of the list's element
@return a newly created array list
512354
public static <T> List<T> toList(Object array, Class<T> clazz) {
        List<T> list = new ArrayList<>();
        for (Object o : toObjectArray(array)) {
            list.add(Reflection.toType(o, clazz));
        }
        return list;
    }
417233
public static <T> JSONArray listToJSONArray(final List<T> list) {
        final JSONArray ret = new JSONArray();

        if (null == list) {
            return ret;
        }

        for (final T object : list) {
            ret.put(object);
        }

        return ret;
    }
1108026
public static boolean isArray( Class clazz ) {
      return clazz != null
            && (clazz.isArray() || Collection.class.isAssignableFrom( clazz ) || (JSONArray.class.isAssignableFrom( clazz )));
   }
1206325
public static <T> List<T> toList(final T[] array) {

    if (array != null) {
      List<T> list = new ArrayList<T>(array.length);
      for (T element : array) {
        list.add(element);
      }
      return list;
    } else {
      return new ArrayList<T>(0);
    }
  }
229215
public static Array listToArray(String list, char delimiter) {
	if (list.length() == 0) return new ArrayImpl();
	int len = list.length();
	int last = 0;

	Array array = new ArrayImpl();
	try {
	    for (int i = 0; i < len; i++) {
		if (list.charAt(i) == delimiter) {
		    array.append(list.substring(last, i));
		    last = i + 1;
		}
	    }
	    if (last <= len) array.append(list.substring(last));
	}
	catch (PageException e) {}
	return array;
    }
976148
public static IBond[] getBondArray(List<IBond> list) {
        IBond[] ret = new IBond[list.size()];
        for (int i = 0; i < ret.length; ++i)
            ret[i] = list.get(i);
        return ret;
    }
977967
public static boolean arrayFilter(Class clazz) {

        if (!clazz.isArray()) {
            return false;
        }

        String arrayType = getArrayComponentName(clazz);

        return nameFilter(arrayType);
    }
245905
protected <T> List<T> toArrayList(List<T> list) {
        if (list == null) {
            return null;
        }
        if (!list.getClass().equals(ArrayList.class)) {
            list = new ArrayList<>(list);
        }
        return list;
    }
192975
public static List<Object> array2ObjectList(final Object array) {
        final int length = Array.getLength(array);
        final List<Object> list = new ArrayList<Object>(length);
        for (int i = 0; i < length; ++i) {
            list.add(Array.get(array, i));
        }
        return list;
    }
999589
public static <T> QueryParameterValue array(T[] array, Class<T> clazz) {
    return array(array, classToType(clazz));
  }
208111
public static List primitiveArrayToList(Object array) {
        int size = Array.getLength(array);
        List list = new ArrayList(size);
        for (int i = 0; i < size; i++) {
            Object item = Array.get(array, i);
            if (item != null && item.getClass().isArray() && item.getClass().getComponentType().isPrimitive()) {
                item = primitiveArrayToList(item);
            }
            list.add(item);
        }
        return list;
    }
493304
protected function toArray( array $list )
	{
		$result = [];

		foreach( $list as $item ) {
			$result[] = (object) $item->toArray( true );
		}

		return $result;
	}
1005038
private Array store(Class clazz) {
	Constructor[] conArr = clazz.getConstructors();
	Array args = new ArrayImpl();
	for (int i = 0; i < conArr.length; i++) {
	    storeArgs(conArr[i], args);
	}
	map.put(clazz, args);
	return args;

    }
585634
public static List<Integer> asList (int[] list)
    {
        if (list == null) {
            return null;
        }
        List<Integer> ilist = new ArrayList<Integer>(list.length);
        for (int ii = 0; ii < list.length; ii++) {
            ilist.add(list[ii]);
        }
        return ilist;
    }
1116005
public static String arrayToListTrim(String[] array, String delimiter) {
	return trim(arrayToList(array, delimiter), delimiter, false);
    }
577306
public static String[] toStringArray(final Object array) {
        final int length = Array.getLength(array);
        final String[] result = new String[length];
        for (int i = 0; i < length; i++) {
            result[i] = Array.get(array, i).toString();
        }
        return result;
    }
20806
private static List<Object> arrayToList(final Object array) {
    if (array instanceof Object[])
      return Arrays.asList((Object[]) array);

    List<Object> result = new ArrayList<Object>();
    // Arrays of the primitive types can't be cast to array of Object, so this:
    if (array instanceof int[])
      for (int value : (int[]) array) result.add(value);
    else if (array instanceof boolean[])
      for (boolean value : (boolean[]) array) result.add(value);
    else if (array instanceof long[])
      for (long value : (long[]) array) result.add(value);
    else if (array instanceof float[])
      for (float value : (float[]) array) result.add(value);
    else if (array instanceof double[])
      for (double value : (double[]) array) result.add(value);
    else if (array instanceof short[])
      for (short value : (short[]) array) result.add(value);
    else if (array instanceof byte[])
      for (byte value : (byte[]) array) result.add(value);
    else if (array instanceof char[])
      for (char value : (char[]) array) result.add(value);
    return result;
  }