/** * Returns the maximum value in the given array, or <code>Integer.MIN_VALUE</code> if the given * array has a size of 0. * * @param array The array * @return The maximum value */ public static int max(IntArrayND array) { return array.stream().parallel().reduce(Integer.MIN_VALUE, Math::max); }
/** * Computes the hash code of the given array. This method will return a hash code that solely * depends on the contents of the given array, regardless of its preferred iteration order. * * @param array The array * @return The hash code */ static int hashCode(IntArrayND array) { if (array == null) { return 0; } return array.stream().parallel().sum(); }
/** * Returns the minimum value in the given array, or <code>Integer.MAX_VALUE</code> if the given * array has a size of 0. * * @param array The array * @return The minimum value */ public static int min(IntArrayND array) { return array.stream().parallel().reduce(Integer.MAX_VALUE, Math::min); }