This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/master by this push: new ca36503562 GROOVY-11330: Remove experimental AGM minBy/maxBy @Incubating methods now that selection by parameter count is improved ca36503562 is described below commit ca365035622a13b097af23ddbfb06245576863ec Author: Paul King <pa...@asert.com.au> AuthorDate: Fri Mar 8 05:50:56 2024 +1000 GROOVY-11330: Remove experimental AGM minBy/maxBy @Incubating methods now that selection by parameter count is improved --- .../groovy/runtime/ArrayGroovyMethods.java | 178 --------------------- 1 file changed, 178 deletions(-) diff --git a/src/main/java/org/codehaus/groovy/runtime/ArrayGroovyMethods.java b/src/main/java/org/codehaus/groovy/runtime/ArrayGroovyMethods.java index 2ea0a908a5..d3b7b9f96d 100644 --- a/src/main/java/org/codehaus/groovy/runtime/ArrayGroovyMethods.java +++ b/src/main/java/org/codehaus/groovy/runtime/ArrayGroovyMethods.java @@ -5499,95 +5499,6 @@ public class ArrayGroovyMethods extends DefaultGroovyMethodsSupport { // - /** - * Selects the maximum value found from the int array - * using the closure to determine the maximum of any two values. - * <p> - * <pre class="groovyTestCase"> - * int[] nums = [30, 45, 60, 90] - * assert 90 == nums.maxBy{ Math.sin(Math.toRadians(it)) } - * assert 30 == nums.maxBy{ Math.cos(Math.toRadians(it)) } // cos(90) == 0 - * </pre> - * <p> - * If the closure has two parameters it is used like a traditional Comparator, - * i.e., it should compare its two parameters for order, returning a negative integer, - * zero, or a positive integer when the first parameter is less than, - * equal to, or greater than the second respectively. Otherwise, - * the Closure is assumed to take a single parameter and return a - * Comparable (typically an Integer) which is then used for - * further comparison. - * - * @param self an int array - * @param closure a Closure used to determine the correct ordering - * @return the maximum value - * @see DefaultGroovyMethods#max(Iterator, groovy.lang.Closure) - * @since 5.0.0 - */ - @Incubating - public static int maxBy(int[] self, @ClosureParams(FirstParam.Component.class) Closure<?> closure) { - return DefaultGroovyMethods.max(new IntArrayIterator(self), closure); - } - - /** - * Selects the maximum value found from the long array - * using the closure to determine the maximum of any two values. - * <p> - * <pre class="groovyTestCase"> - * long[] nums = [-30L, 10L, 20L] - * assert 20L == nums.maxBy{ a, b {@code ->} a {@code <=>} b } - * assert -30L == nums.maxBy{ it.abs() } - * </pre> - * <p> - * If the closure has two parameters it is used like a traditional Comparator, - * i.e., it should compare its two parameters for order, returning a negative integer, - * zero, or a positive integer when the first parameter is less than, - * equal to, or greater than the second respectively. Otherwise, - * the Closure is assumed to take a single parameter and return a - * Comparable (typically an Integer) which is then used for - * further comparison. - * - * @param self a long array - * @param closure a Closure used to determine the correct ordering - * @return the maximum value - * @see DefaultGroovyMethods#max(Iterator, groovy.lang.Closure) - * @since 5.0.0 - */ - @Incubating - public static long maxBy(long[] self, @ClosureParams(FirstParam.Component.class) Closure<?> closure) { - return DefaultGroovyMethods.max(new LongArrayIterator(self), closure); - } - - /** - * Selects the maximum value found from the double array - * using the closure to determine the maximum of any two values. - * <p> - * <pre class="groovyTestCase"> - * double[] nums = [-30.0d, 10.0d, 20.0d] - * assert 20.0d == nums.maxBy{ a, b {@code ->} a {@code <=>} b } - * assert -30.0d == nums.maxBy{ it.abs() } - * </pre> - * <p> - * If the closure has two parameters it is used like a traditional Comparator, - * i.e., it should compare its two parameters for order, returning a negative integer, - * zero, or a positive integer when the first parameter is less than, - * equal to, or greater than the second respectively. Otherwise, - * the Closure is assumed to take a single parameter and return a - * Comparable (typically an Integer) which is then used for - * further comparison. - * - * @param self a double array - * @param closure a Closure used to determine the correct ordering - * @return the maximum value - * @see DefaultGroovyMethods#max(Iterator, groovy.lang.Closure) - * @since 5.0.0 - */ - @Incubating - public static double maxBy(double[] self, @ClosureParams(FirstParam.Component.class) Closure<?> closure) { - return DefaultGroovyMethods.max(new DoubleArrayIterator(self), closure); - } - - // - /** * Selects the maximum value found from the int array * using the comparator to determine the maximum of any two values. @@ -5976,95 +5887,6 @@ public class ArrayGroovyMethods extends DefaultGroovyMethodsSupport { // - /** - * Selects the minimum value found from the int array - * using the closure to determine the minimum of any two values. - * <p> - * <pre class="groovyTestCase"> - * int[] nums = [-20, 10, 30] - * assert -20 == nums.minBy{ a, b {@code ->} a {@code <=>} b } - * assert 10 == nums.minBy{ it.abs() } - * </pre> - * <p> - * If the closure has two parameters it is used like a traditional Comparator, - * i.e., it should compare its two parameters for order, returning a negative integer, - * zero, or a positive integer when the first parameter is less than, - * equal to, or greater than the second respectively. Otherwise, - * the Closure is assumed to take a single parameter and return a - * Comparable (typically an Integer) which is then used for - * further comparison. - * - * @param self an int array - * @param closure a Closure used to determine the correct ordering - * @return the minimum value - * @see DefaultGroovyMethods#min(Iterator, groovy.lang.Closure) - * @since 5.0.0 - */ - @Incubating - public static int minBy(int[] self, @ClosureParams(FirstParam.Component.class) Closure<?> closure) { - return DefaultGroovyMethods.min(new IntArrayIterator(self), closure); - } - - /** - * Selects the minimum value found from the long array - * using the closure to determine the minimum of any two values. - * <p> - * <pre class="groovyTestCase"> - * long[] nums = [-20L, 10L, 30L] - * assert -20L == nums.minBy{ a, b {@code ->} a {@code <=>} b } - * assert 10L == nums.minBy{ it.abs() } - * </pre> - * <p> - * If the closure has two parameters it is used like a traditional Comparator, - * i.e., it should compare its two parameters for order, returning a negative integer, - * zero, or a positive integer when the first parameter is less than, - * equal to, or greater than the second respectively. Otherwise, - * the Closure is assumed to take a single parameter and return a - * Comparable (typically an int or long) which is then used for - * further comparison. - * - * @param self a long array - * @param closure a Closure used to determine the correct ordering - * @return the minimum value - * @see DefaultGroovyMethods#min(Iterator, groovy.lang.Closure) - * @since 5.0.0 - */ - @Incubating - public static long minBy(long[] self, @ClosureParams(FirstParam.Component.class) Closure<?> closure) { - return DefaultGroovyMethods.min(new LongArrayIterator(self), closure); - } - - /** - * Selects the minimum value found from the double array - * using the closure to determine the minimum of any two values. - * <p> - * <pre class="groovyTestCase"> - * double[] nums = [-20.0d, 10.0d, 30.0d] - * assert -20.0d == nums.minBy{ a, b {@code ->} a {@code <=>} b } - * assert 10.0d == nums.minBy{ it.abs() } - * </pre> - * <p> - * If the closure has two parameters it is used like a traditional Comparator, - * i.e., it should compare its two parameters for order, returning a negative integer, - * zero, or a positive integer when the first parameter is less than, - * equal to, or greater than the second respectively. Otherwise, - * the Closure is assumed to take a single parameter and return a - * Comparable (typically an int or double) which is then used for - * further comparison. - * - * @param self a double array - * @param closure a Closure used to determine the correct ordering - * @return the minimum value - * @see DefaultGroovyMethods#min(Iterator, groovy.lang.Closure) - * @since 5.0.0 - */ - @Incubating - public static double minBy(double[] self, @ClosureParams(FirstParam.Component.class) Closure<?> closure) { - return DefaultGroovyMethods.min(new DoubleArrayIterator(self), closure); - } - - // - /** * Selects the minimum value found from the int array * using the comparator to determine the minimum of any two values.