_Arrays { public static <T> T[] removeByIndex(T[] array, int index) { if(array==null || array.length<1) { throw new IllegalArgumentException("Array must be of lenght 1 or larger."); } if(index<0 || index>=array.length) { val msg = String.format("Array index %d is out of bounds [0, %d]", index, array.length-1); throw new IllegalArgumentException(msg); } final T[] result = Arrays.copyOf(array, array.length - 1); val remaining = result.length - index; System.arraycopy(array, index+1, result, index, remaining); return result; }  static boolean testAnyMatch(
            @Nullable final T[] array1, 
            @Nullable final T[] array2, 
            final BiPredicate<T, T> test); static boolean testAllMatch(
            @Nullable final T[] array1, 
            @Nullable final T[] array2, 
            final BiPredicate<T, T> test); static boolean isArrayType(@Nullable final Class<?> cls); static boolean isCollectionOrArrayType(final Class<?> cls); static Collector<T,?,T[]> toArray(final Class<T> componentType, final int length); static Collector<T,?,T[]> toArray(final Class<T> componentType); @SafeVarargs static T[] combine(T first, @Nullable  T... rest); @SafeVarargs static T[] combineWithExplicitType(Class<T> type, X first, @Nullable  Y... rest); @SafeVarargs static T[] combine(T[] first, T... rest); static T[] toArray(@Nullable final Collection<? extends T> collection, final Class<T> componentType); static T[] toArray(@Nullable final Iterable<? extends T> iterable, final Class<T> componentType); static T[] removeByIndex(T[] array, int index); static @Nullable T[] emptyToNull(T[] array); static @Nullable Class<?> inferComponentTypeIfAny(@Nullable final Class<?> arrayType); static Optional<T> get(@Nullable T[] array, int index); @Nullable static R[] map(
            @Nullable T[] array, 
            @NonNull Class<R> resultElementType, 
            @NonNull Function<T, R> mapper); @Nullable static Object[] map(
            @Nullable T[] array, 
            @NonNull Function<T, ?> mapper); @Nullable static R[] mapCollection(
            @Nullable Collection<T> collection, 
            @NonNull Class<R> resultElementType, 
            @NonNull Function<T, R> mapper); @Nullable static Object[] mapCollection(
            @Nullable Collection<T> collection, 
            @NonNull Function<T, ?> mapper);  }
@Test void removeByIndex_head() { val input = new Integer[] {0, 1, 2, 3}; val output = _Arrays.removeByIndex(input, 0); assertArrayEquals(new Integer[] {1, 2, 3}, output); }
@Test void removeByIndex_inBetween() { val input = new Integer[] {0, 1, 2, 3}; val output = _Arrays.removeByIndex(input, 1); assertArrayEquals(new Integer[] {0, 2, 3}, output); }
@Test void removeByIndex_tail() { val input = new Integer[] {0, 1, 2, 3}; val output = _Arrays.removeByIndex(input, 3); assertArrayEquals(new Integer[] {0, 1, 2}, output); }
@Test void removeByIndex_outOfBounds() { val input = new Integer[] {0, 1, 2, 3}; assertThrows(IllegalArgumentException.class, ()->_Arrays.removeByIndex(input, 4)); }
@Test void removeByIndex_empty() { val input = new Integer[] {}; assertThrows(IllegalArgumentException.class, ()->_Arrays.removeByIndex(input, 0)); }
@Test void removeByIndex_null() { val input = (Integer[])null; assertThrows(IllegalArgumentException.class, ()->_Arrays.removeByIndex(input, 0)); }