/** * Null-safe method to return the first element in the array or {@literal null} * if the array is {@literal null} or empty. * * @param <T> Class type of the array elements. * @param array the array from which to extract the first element. * @return the first element in the array or {@literal null} if the array is null or empty. * @see #getFirst(Object[], Object) */ public static <T> T getFirst(T[] array) { return getFirst(array, null); }
/** * Null-safe method to return the first element in the array or {@literal null} * if the array is {@literal null} or empty. * * @param <T> Class type of the array elements. * @param array the array from which to extract the first element. * @return the first element in the array or {@literal null} if the array is null or empty. * @see #getFirst(Object[], Object) */ public static <T> T getFirst(T[] array) { return getFirst(array, null); }