/** * Creates a new array initialised with default values to a desired length. * * @param <T> Array type. * @param array The original array to mimic. * @param newLength The length of the new array. * @return The new array instance. */ public static <T> T clear(T array, int newLength) { return allocate(Classes.<Class<T>>cast(array.getClass()), newLength); }