Returns a newly created random access list with the contents of the
provided arrays.

@param <E> any class.
@param arrs one or more <code>E[]</code>.
@return a newly created random access {@link List}.
766180
@SafeVarargs
    public static <E> List<E> asList(E[]... arrs) {
        int size = 0;
        for (E[] arr : arrs) {
            if (arr == null) {
                throw new IllegalArgumentException("Null arrays not allowed");
            }
            size += arr.length;
        }
        List<E> result = new ArrayList<>(size);
        addAll(result, arrs);
        return result;
    }
1000605
public static String[] copyArrayCutFirst(String[] arr) {
        if(arr.length > 1) {
            String[] arrCopy = new String[arr.length - 1];
            System.arraycopy(arr, 1, arrCopy, 0, arrCopy.length);
            return arrCopy;
        } else {
            return new String[0];
        }
    }
1230734
public static <T> T getRandomItem(T[] arr) {
		return arr[rand.nextInt(arr.length)];
	}
358595
public static ArrayList<String> toList( String[] array )
	{
		if( array == null )
		{
			return new ArrayList<String>( 0 );
		}
		ArrayList<String> list = new ArrayList<String>( array.length );
		for (String s : array)
		{
			list.add( s );
		}
		return list;
	}
963287
public Object[] toArray(List<?> list, Class<?> arrayType) {
        int[] dims = findArrayDimensions(list, arrayType);
        Object[] typedArray = (Object[]) Array.newInstance(arrayType, dims);
        return list.toArray(typedArray);
    }
260211
protected static <U> Class<U>[] asArray(Class<U> clazz) {
		@SuppressWarnings("unchecked")
		Class<U>[] array = new Class[] { clazz };
		return array;
	}
1062936
private static String list(String[] arr, int from, int len) {
	StringBuffer sb = new StringBuffer();
	for (int i = from; i < len; i++) {
	    sb.append(arr[i]);
	    if (i + 1 != arr.length) sb.append('/');
	}
	return sb.toString();
    }
223141
public static <T> ArrayList<T> newArrayList(Iterable<T> elements) {
		return Lists.newArrayList(elements);
	}
600659
static <T> ArraySet<T> fromArray(List<T> aArray, Boolean aAllowDuplicates) {
        ArraySet<T> set = new ArraySet<>();
        for (int i = 0, len = aArray.size(); i < len; i++) {
            set.add(aArray.get(i), aAllowDuplicates);
        }
        return set;
    }
367296
@SuppressWarnings("unchecked")
    public static <T extends Example> T[] asArray( T example )
    {
        List<Example> examples = asList( example );
        T[] array = (T[]) Array.newInstance( example.getClass(), examples.size() );
        return examples.toArray( array );
    }
263041
@SafeVarargs
    public static <E> void addAll(Collection<E> collection, E[]... arr) {
        if (collection == null) {
            throw new IllegalArgumentException("collection cannot be null");
        }
        for (E[] oarr : arr) {
            for (E o : oarr) {
                collection.add(o);
            }
        }
    }
1126139
function listAsArray(list){

   return foldR( function(arraySoFar, listItem){
      
      arraySoFar.unshift(listItem);
      return arraySoFar;
           
   }, [], list );
   
}
758544
public static <E extends List<Boolean>> E asList(boolean[] array, Class<E> listType) {
		E result;
		try {
			result = listType.newInstance();

			for (Object item : array) {
				result.add((boolean) item);
			}

			return result;
		} catch (InstantiationException | IllegalAccessException e) {
			e.printStackTrace();
			throw (new KriptonRuntimeException(e.getMessage()));
		}
	}
1347114
public static Object[] toArray(List<?> list) {
	Iterator<?> it = list.iterator();
	Class clazz = null;
	while (it.hasNext()) {
	    Object v = it.next();
	    if (v == null) continue;
	    if (clazz == null) clazz = v.getClass();
	    else if (clazz != v.getClass()) return list.toArray();
	}
	if (clazz == Object.class || clazz == null) return list.toArray();

	Object arr = java.lang.reflect.Array.newInstance(clazz, list.size());
	return list.toArray((Object[]) arr);
    }
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;
    }
390450
public static <T> T randomFromList(List<T> ls) {
    return ls.get(new Random().nextInt(ls.size()));
  }
1163516
@SafeVarargs
  public static <T> ArrayList<T> newArrayList(final Iterable<T>... iterables) {
    final ArrayList<T> resultList = newArrayList();
    for (final Iterable<T> oneIterable : iterables) {
      for (final T oneElement : oneIterable) {
        resultList.add(oneElement);
      }
    }
    return resultList;
  }