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

commit 0c48fa2e4e48f4fa0cc75fe30d9c1157a169880a
Author: John Dong <[email protected]>
AuthorDate: Tue May 6 08:33:45 2025 +0800

    add partitionPoint to Groovy Array and List - revert method name to 
partitionPoint, prefer Predicate<T> to Closure<?>, DGM prefer List to 
AbstractList
---
 .../groovy/runtime/ArrayGroovyMethods.java         | 203 +++++++++++----------
 .../groovy/runtime/DefaultGroovyMethods.java       |  37 ++--
 2 files changed, 120 insertions(+), 120 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/runtime/ArrayGroovyMethods.java 
b/src/main/java/org/codehaus/groovy/runtime/ArrayGroovyMethods.java
index 9a3bc29b1c..d11be9d804 100644
--- a/src/main/java/org/codehaus/groovy/runtime/ArrayGroovyMethods.java
+++ b/src/main/java/org/codehaus/groovy/runtime/ArrayGroovyMethods.java
@@ -87,6 +87,7 @@ import java.util.function.IntConsumer;
 import java.util.function.IntUnaryOperator;
 import java.util.function.LongConsumer;
 import java.util.function.LongUnaryOperator;
+import java.util.function.Predicate;
 import java.util.function.IntPredicate;
 import java.util.function.LongPredicate;
 import java.util.function.DoublePredicate;
@@ -6580,7 +6581,7 @@ public class ArrayGroovyMethods extends 
DefaultGroovyMethodsSupport {
     }
 
     
//--------------------------------------------------------------------------
-    // binaryPartitionPoint
+    // partitionPoint
 
     /**
      * Returns the index of the partition point according to the given 
predicate
@@ -6588,21 +6589,21 @@ public class ArrayGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * The arr is assumed to be partitioned according to the given predicate.
      * <pre class="groovyTestCase">
      * def arr = [7, 15, 3, 5, 4, 12, 6] as Integer[]
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it%2 != 0 } == 4
+     * assert arr.partitionPoint(0..<arr.size()) { it%2 != 0 } == 4
      * </pre>
      *
      * <pre class="groovyTestCase">
      * def arr = [1, 2, 3, 3, 4, 4, 5, 6, 7] as Integer[]
      * //usage case as lowerBound(cpp), bisect_left(python)
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it < 4 } == 4
+     * assert arr.partitionPoint(0..<arr.size()) { it < 4 } == 4
      * //usage case as upperBound(cpp), bisect_right(python)
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it <= 4 } == 6
+     * assert arr.partitionPoint(0..<arr.size()) { it <= 4 } == 6
      * //for all match condition
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it <= 100 } == 
arr.size()
+     * assert arr.partitionPoint(0..<arr.size()) { it <= 100 } == arr.size()
      * //for none match condition
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it <= 0 } == 0
+     * assert arr.partitionPoint(0..<arr.size()) { it <= 0 } == 0
      * //for none match condition with range
-     * assert arr.binaryPartitionPoint(2..<arr.size()) { it <= 0 } == 2
+     * assert arr.partitionPoint(2..<arr.size()) { it <= 0 } == 2
      * </pre>
      *
      * @param self      a groovy arr
@@ -6611,16 +6612,16 @@ public class ArrayGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * @return an integer that is the index of the first element of the second 
partition
      * @since 5.0
      */
-    public static <T> int binaryPartitionPoint(T[] self, IntRange intRange, 
@ClosureParams(FirstParam.FirstGenericType.class) Closure<?> condition) {
+    public static <T> int partitionPoint(T[] self, IntRange intRange, 
Predicate<T> condition) {
         Objects.requireNonNull(self);
         assert !intRange.isReverse();
         Objects.checkFromToIndex(intRange.getFromInt(),intRange.getToInt(), 
self.length);
+
         int result = intRange.getFromInt();
-        BooleanClosureWrapper bcw = new BooleanClosureWrapper(condition);
         int left = intRange.getFromInt(), right = intRange.getToInt();
         while (left <= right) {
             int mid = left + (right - left) / 2;
-            if (bcw.call(self[mid])) {
+            if (condition.test(self[mid])) {
                 result = mid + 1;
                 left = mid + 1;
             } else {
@@ -6636,19 +6637,19 @@ public class ArrayGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * The arr is assumed to be partitioned according to the given predicate.
      * <pre class="groovyTestCase">
      * def arr = [7, 15, 3, 5, 4, 12, 6] as Integer[]
-     * assert arr.binaryPartitionPoint{ it%2 != 0 } == 4
+     * assert arr.partitionPoint{ it%2 != 0 } == 4
      * </pre>
      *
      * <pre class="groovyTestCase">
      * def arr = [1, 2, 3, 3, 4, 4, 5, 6, 7] as Integer[]
      * //usage case as lowerBound(cpp), bisect_left(python)
-     * assert arr.binaryPartitionPoint{ it < 4 } == 4
+     * assert arr.partitionPoint{ it < 4 } == 4
      * //usage case as upperBound(cpp), bisect_right(python)
-     * assert arr.binaryPartitionPoint{ it <= 4 } == 6
+     * assert arr.partitionPoint{ it <= 4 } == 6
      * //for all match condition
-     * assert arr.binaryPartitionPoint{ it <= 100 } == arr.size()
+     * assert arr.partitionPoint{ it <= 100 } == arr.size()
      * //for none match condition
-     * assert arr.binaryPartitionPoint{ it <= 0 } == 0
+     * assert arr.partitionPoint{ it <= 0 } == 0
      * </pre>
      *
      * @param self      a groovy arr
@@ -6656,8 +6657,8 @@ public class ArrayGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * @return an integer that is the index of the first element of the second 
partition
      * @since 5.0
      */
-    public static <T> int binaryPartitionPoint(T[] self, 
@ClosureParams(FirstParam.FirstGenericType.class) Closure<?> condition) {
-        return binaryPartitionPoint(self, new IntRange(0, self.length - 1), 
condition);
+    public static <T> int partitionPoint(T[] self, Predicate<T> condition) {
+        return partitionPoint(self, new IntRange(0, self.length - 1), 
condition);
     }
 
     /**
@@ -6666,21 +6667,21 @@ public class ArrayGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * The arr is assumed to be partitioned according to the given predicate.
      * <pre class="groovyTestCase">
      * def arr = [7, 15, 3, 5, 4, 12, 6] as char[]
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it%2 != 0 } == 4
+     * assert arr.partitionPoint(0..<arr.size()) { it%2 != 0 } == 4
      * </pre>
      *
      * <pre class="groovyTestCase">
      * def arr = [1, 2, 3, 3, 4, 4, 5, 6, 7] as char[]
      * //usage case as lowerBound(cpp), bisect_left(python)
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it < 4 } == 4
+     * assert arr.partitionPoint(0..<arr.size()) { it < 4 } == 4
      * //usage case as upperBound(cpp), bisect_right(python)
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it <= 4 } == 6
+     * assert arr.partitionPoint(0..<arr.size()) { it <= 4 } == 6
      * //for all match condition
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it <= 100 } == 
arr.size()
+     * assert arr.partitionPoint(0..<arr.size()) { it <= 100 } == arr.size()
      * //for none match condition
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it <= 0 } == 0
+     * assert arr.partitionPoint(0..<arr.size()) { it <= 0 } == 0
      * //for none match condition with range
-     * assert arr.binaryPartitionPoint(2..<arr.size()) { it <= 0 } == 2
+     * assert arr.partitionPoint(2..<arr.size()) { it <= 0 } == 2
      * </pre>
      *
      * @param self      a groovy arr
@@ -6689,7 +6690,7 @@ public class ArrayGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * @return an integer that is the index of the first element of the second 
partition
      * @since 5.0
      */
-    public static int binaryPartitionPoint(char[] self, IntRange intRange, 
IntPredicate condition) {
+    public static int partitionPoint(char[] self, IntRange intRange, 
IntPredicate condition) {
         Objects.requireNonNull(self);
         assert !intRange.isReverse();
         Objects.checkFromToIndex(intRange.getFromInt(),intRange.getToInt(), 
self.length);
@@ -6714,19 +6715,19 @@ public class ArrayGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * The arr is assumed to be partitioned according to the given predicate.
      * <pre class="groovyTestCase">
      * def arr = [7, 15, 3, 5, 4, 12, 6] as char[]
-     * assert arr.binaryPartitionPoint{ it%2 != 0 } == 4
+     * assert arr.partitionPoint{ it%2 != 0 } == 4
      * </pre>
      *
      * <pre class="groovyTestCase">
      * def arr = [1, 2, 3, 3, 4, 4, 5, 6, 7] as char[]
      * //usage case as lowerBound(cpp), bisect_left(python)
-     * assert arr.binaryPartitionPoint{ it < 4 } == 4
+     * assert arr.partitionPoint{ it < 4 } == 4
      * //usage case as upperBound(cpp), bisect_right(python)
-     * assert arr.binaryPartitionPoint{ it <= 4 } == 6
+     * assert arr.partitionPoint{ it <= 4 } == 6
      * //for all match condition
-     * assert arr.binaryPartitionPoint{ it <= 100 } == arr.size()
+     * assert arr.partitionPoint{ it <= 100 } == arr.size()
      * //for none match condition
-     * assert arr.binaryPartitionPoint{ it <= 0 } == 0
+     * assert arr.partitionPoint{ it <= 0 } == 0
      * </pre>
      *
      * @param self      a groovy arr
@@ -6734,8 +6735,8 @@ public class ArrayGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * @return an integer that is the index of the first element of the second 
partition
      * @since 5.0
      */
-    public static int binaryPartitionPoint(char[] self, IntPredicate 
condition) {
-        return binaryPartitionPoint(self, new IntRange(0, self.length - 1), 
condition);
+    public static int partitionPoint(char[] self, IntPredicate condition) {
+        return partitionPoint(self, new IntRange(0, self.length - 1), 
condition);
     }
 
     /**
@@ -6744,21 +6745,21 @@ public class ArrayGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * The arr is assumed to be partitioned according to the given predicate.
      * <pre class="groovyTestCase">
      * def arr = [7, 15, 3, 5, 4, 12, 6] as short[]
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it%2 != 0 } == 4
+     * assert arr.partitionPoint(0..<arr.size()) { it%2 != 0 } == 4
      * </pre>
      *
      * <pre class="groovyTestCase">
      * def arr = [1, 2, 3, 3, 4, 4, 5, 6, 7] as short[]
      * //usage case as lowerBound(cpp), bisect_left(python)
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it < 4 } == 4
+     * assert arr.partitionPoint(0..<arr.size()) { it < 4 } == 4
      * //usage case as upperBound(cpp), bisect_right(python)
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it <= 4 } == 6
+     * assert arr.partitionPoint(0..<arr.size()) { it <= 4 } == 6
      * //for all match condition
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it <= 100 } == 
arr.size()
+     * assert arr.partitionPoint(0..<arr.size()) { it <= 100 } == arr.size()
      * //for none match condition
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it <= 0 } == 0
+     * assert arr.partitionPoint(0..<arr.size()) { it <= 0 } == 0
      * //for none match condition with range
-     * assert arr.binaryPartitionPoint(2..<arr.size()) { it <= 0 } == 2
+     * assert arr.partitionPoint(2..<arr.size()) { it <= 0 } == 2
      * </pre>
      *
      * @param self      a groovy arr
@@ -6767,7 +6768,7 @@ public class ArrayGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * @return an integer that is the index of the first element of the second 
partition
      * @since 5.0
      */
-    public static int binaryPartitionPoint(short[] self, IntRange intRange, 
IntPredicate condition) {
+    public static int partitionPoint(short[] self, IntRange intRange, 
IntPredicate condition) {
         Objects.requireNonNull(self);
         assert !intRange.isReverse();
         Objects.checkFromToIndex(intRange.getFromInt(),intRange.getToInt(), 
self.length);
@@ -6792,19 +6793,19 @@ public class ArrayGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * The arr is assumed to be partitioned according to the given predicate.
      * <pre class="groovyTestCase">
      * def arr = [7, 15, 3, 5, 4, 12, 6] as short[]
-     * assert arr.binaryPartitionPoint{ it%2 != 0 } == 4
+     * assert arr.partitionPoint{ it%2 != 0 } == 4
      * </pre>
      *
      * <pre class="groovyTestCase">
      * def arr = [1, 2, 3, 3, 4, 4, 5, 6, 7] as short[]
      * //usage case as lowerBound(cpp), bisect_left(python)
-     * assert arr.binaryPartitionPoint{ it < 4 } == 4
+     * assert arr.partitionPoint{ it < 4 } == 4
      * //usage case as upperBound(cpp), bisect_right(python)
-     * assert arr.binaryPartitionPoint{ it <= 4 } == 6
+     * assert arr.partitionPoint{ it <= 4 } == 6
      * //for all match condition
-     * assert arr.binaryPartitionPoint{ it <= 100 } == arr.size()
+     * assert arr.partitionPoint{ it <= 100 } == arr.size()
      * //for none match condition
-     * assert arr.binaryPartitionPoint{ it <= 0 } == 0
+     * assert arr.partitionPoint{ it <= 0 } == 0
      * </pre>
      *
      * @param self      a groovy arr
@@ -6812,8 +6813,8 @@ public class ArrayGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * @return an integer that is the index of the first element of the second 
partition
      * @since 5.0
      */
-    public static int binaryPartitionPoint(short[] self, IntPredicate 
condition) {
-        return binaryPartitionPoint(self, new IntRange(0, self.length - 1), 
condition);
+    public static int partitionPoint(short[] self, IntPredicate condition) {
+        return partitionPoint(self, new IntRange(0, self.length - 1), 
condition);
     }
 
     /**
@@ -6822,21 +6823,21 @@ public class ArrayGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * The arr is assumed to be partitioned according to the given predicate.
      * <pre class="groovyTestCase">
      * def arr = [7, 15, 3, 5, 4, 12, 6] as int[]
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it%2 != 0 } == 4
+     * assert arr.partitionPoint(0..<arr.size()) { it%2 != 0 } == 4
      * </pre>
      *
      * <pre class="groovyTestCase">
      * def arr = [1, 2, 3, 3, 4, 4, 5, 6, 7] as int[]
      * //usage case as lowerBound(cpp), bisect_left(python)
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it < 4 } == 4
+     * assert arr.partitionPoint(0..<arr.size()) { it < 4 } == 4
      * //usage case as upperBound(cpp), bisect_right(python)
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it <= 4 } == 6
+     * assert arr.partitionPoint(0..<arr.size()) { it <= 4 } == 6
      * //for all match condition
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it <= 100 } == 
arr.size()
+     * assert arr.partitionPoint(0..<arr.size()) { it <= 100 } == arr.size()
      * //for all match condition
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it <= 0 } == 0
+     * assert arr.partitionPoint(0..<arr.size()) { it <= 0 } == 0
      * //for none match condition with range
-     * assert arr.binaryPartitionPoint(2..<arr.size()) { it <= 0 } == 2
+     * assert arr.partitionPoint(2..<arr.size()) { it <= 0 } == 2
      * </pre>
      *
      * @param self      a groovy arr
@@ -6845,7 +6846,7 @@ public class ArrayGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * @return an integer that is the index of the first element of the second 
partition
      * @since 5.0
      */
-    public static int binaryPartitionPoint(int[] self, IntRange intRange, 
IntPredicate condition) {
+    public static int partitionPoint(int[] self, IntRange intRange, 
IntPredicate condition) {
         Objects.requireNonNull(self);
         assert !intRange.isReverse();
         Objects.checkFromToIndex(intRange.getFromInt(),intRange.getToInt(), 
self.length);
@@ -6870,19 +6871,19 @@ public class ArrayGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * The arr is assumed to be partitioned according to the given predicate.
      * <pre class="groovyTestCase">
      * def arr = [7, 15, 3, 5, 4, 12, 6] as int[]
-     * assert arr.binaryPartitionPoint{ it%2 != 0 } == 4
+     * assert arr.partitionPoint{ it%2 != 0 } == 4
      * </pre>
      *
      * <pre class="groovyTestCase">
      * def arr = [1, 2, 3, 3, 4, 4, 5, 6, 7] as int[]
      * //usage case as lowerBound(cpp), bisect_left(python)
-     * assert arr.binaryPartitionPoint{ it < 4 } == 4
+     * assert arr.partitionPoint{ it < 4 } == 4
      * //usage case as upperBound(cpp), bisect_right(python)
-     * assert arr.binaryPartitionPoint{ it <= 4 } == 6
+     * assert arr.partitionPoint{ it <= 4 } == 6
      * //for all match condition
-     * assert arr.binaryPartitionPoint{ it <= 100 } == arr.size()
+     * assert arr.partitionPoint{ it <= 100 } == arr.size()
      * //for none match condition
-     * assert arr.binaryPartitionPoint{ it <= 0 } == 0
+     * assert arr.partitionPoint{ it <= 0 } == 0
      * </pre>
      *
      * @param self      a groovy arr
@@ -6890,8 +6891,8 @@ public class ArrayGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * @return an integer that is the index of the first element of the second 
partition
      * @since 5.0
      */
-    public static int binaryPartitionPoint(int[] self, IntPredicate condition) 
{
-        return binaryPartitionPoint(self, new IntRange(0, self.length - 1), 
condition);
+    public static int partitionPoint(int[] self, IntPredicate condition) {
+        return partitionPoint(self, new IntRange(0, self.length - 1), 
condition);
     }
 
     /**
@@ -6900,21 +6901,21 @@ public class ArrayGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * The arr is assumed to be partitioned according to the given predicate.
      * <pre class="groovyTestCase">
      * def arr = [7, 15, 3, 5, 4, 12, 6] as long[]
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it%2 != 0 } == 4
+     * assert arr.partitionPoint(0..<arr.size()) { it%2 != 0 } == 4
      * </pre>
      *
      * <pre class="groovyTestCase">
      * def arr = [1, 2, 3, 3, 4, 4, 5, 6, 7] as long[]
      * //usage case as lowerBound(cpp), bisect_left(python)
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it < 4 } == 4
+     * assert arr.partitionPoint(0..<arr.size()) { it < 4 } == 4
      * //usage case as upperBound(cpp), bisect_right(python)
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it <= 4 } == 6
+     * assert arr.partitionPoint(0..<arr.size()) { it <= 4 } == 6
      * //for all match condition
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it <= 100 } == 
arr.size()
+     * assert arr.partitionPoint(0..<arr.size()) { it <= 100 } == arr.size()
      * //for none match condition
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it <= 0 } == 0
+     * assert arr.partitionPoint(0..<arr.size()) { it <= 0 } == 0
      * //for none match condition with range
-     * assert arr.binaryPartitionPoint(2..<arr.size()) { it <= 0 } == 2
+     * assert arr.partitionPoint(2..<arr.size()) { it <= 0 } == 2
      * </pre>
      *
      * @param self      a groovy arr
@@ -6923,7 +6924,7 @@ public class ArrayGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * @return an integer that is the index of the first element of the second 
partition
      * @since 5.0
      */
-    public static int binaryPartitionPoint(long[] self, IntRange intRange, 
LongPredicate condition) {
+    public static int partitionPoint(long[] self, IntRange intRange, 
LongPredicate condition) {
         Objects.requireNonNull(self);
         assert !intRange.isReverse();
         Objects.checkFromToIndex(intRange.getFromInt(),intRange.getToInt(), 
self.length);
@@ -6948,19 +6949,19 @@ public class ArrayGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * The arr is assumed to be partitioned according to the given predicate.
      * <pre class="groovyTestCase">
      * def arr = [7, 15, 3, 5, 4, 12, 6] as long[]
-     * assert arr.binaryPartitionPoint{ it%2 != 0 } == 4
+     * assert arr.partitionPoint{ it%2 != 0 } == 4
      * </pre>
      *
      * <pre class="groovyTestCase">
      * def arr = [1, 2, 3, 3, 4, 4, 5, 6, 7] as long[]
      * //usage case as lowerBound(cpp), bisect_left(python)
-     * assert arr.binaryPartitionPoint{ it < 4 } == 4
+     * assert arr.partitionPoint{ it < 4 } == 4
      * //usage case as upperBound(cpp), bisect_right(python)
-     * assert arr.binaryPartitionPoint{ it <= 4 } == 6
+     * assert arr.partitionPoint{ it <= 4 } == 6
      * //for all match condition
-     * assert arr.binaryPartitionPoint{ it <= 100 } == arr.size()
+     * assert arr.partitionPoint{ it <= 100 } == arr.size()
      * //for none match condition
-     * assert arr.binaryPartitionPoint{ it <= 0 } == 0
+     * assert arr.partitionPoint{ it <= 0 } == 0
      * </pre>
      *
      * @param self      a groovy arr
@@ -6968,8 +6969,8 @@ public class ArrayGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * @return an integer that is the index of the first element of the second 
partition
      * @since 5.0
      */
-    public static int binaryPartitionPoint(long[] self, LongPredicate 
condition) {
-        return binaryPartitionPoint(self, new IntRange(0, self.length - 1), 
condition);
+    public static int partitionPoint(long[] self, LongPredicate condition) {
+        return partitionPoint(self, new IntRange(0, self.length - 1), 
condition);
     }
 
     /**
@@ -6978,21 +6979,21 @@ public class ArrayGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * The arr is assumed to be partitioned according to the given predicate.
      * <pre class="groovyTestCase">
      * def arr = [7, 15, 3, 5, 4, 12, 6] as float[]
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it%2 != 0 } == 4
+     * assert arr.partitionPoint(0..<arr.size()) { it%2 != 0 } == 4
      * </pre>
      *
      * <pre class="groovyTestCase">
      * def arr = [1, 2, 3, 3, 4, 4, 5, 6, 7] as float[]
      * //usage case as lowerBound(cpp), bisect_left(python)
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it < 4 } == 4
+     * assert arr.partitionPoint(0..<arr.size()) { it < 4 } == 4
      * //usage case as upperBound(cpp), bisect_right(python)
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it <= 4 } == 6
+     * assert arr.partitionPoint(0..<arr.size()) { it <= 4 } == 6
      * //for all match condition
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it <= 100 } == 
arr.size()
+     * assert arr.partitionPoint(0..<arr.size()) { it <= 100 } == arr.size()
      * //for none match condition
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it <= 0 } == 0
+     * assert arr.partitionPoint(0..<arr.size()) { it <= 0 } == 0
      * //for none match condition with range
-     * assert arr.binaryPartitionPoint(2..<arr.size()) { it <= 0 } == 2
+     * assert arr.partitionPoint(2..<arr.size()) { it <= 0 } == 2
      * </pre>
      *
      * @param self      a groovy arr
@@ -7001,7 +7002,7 @@ public class ArrayGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * @return an integer that is the index of the first element of the second 
partition
      * @since 5.0
      */
-    public static int binaryPartitionPoint(float[] self, IntRange intRange, 
DoublePredicate condition) {
+    public static int partitionPoint(float[] self, IntRange intRange, 
DoublePredicate condition) {
         Objects.requireNonNull(self);
         assert !intRange.isReverse();
         Objects.checkFromToIndex(intRange.getFromInt(),intRange.getToInt(), 
self.length);
@@ -7026,19 +7027,19 @@ public class ArrayGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * The arr is assumed to be partitioned according to the given predicate.
      * <pre class="groovyTestCase">
      * def arr = [7, 15, 3, 5, 4, 12, 6] as float[]
-     * assert arr.binaryPartitionPoint{ it%2 != 0 } == 4
+     * assert arr.partitionPoint{ it%2 != 0 } == 4
      * </pre>
      *
      * <pre class="groovyTestCase">
      * def arr = [1, 2, 3, 3, 4, 4, 5, 6, 7] as float[]
      * //usage case as lowerBound(cpp), bisect_left(python)
-     * assert arr.binaryPartitionPoint{ it < 4 } == 4
+     * assert arr.partitionPoint{ it < 4 } == 4
      * //usage case as upperBound(cpp), bisect_right(python)
-     * assert arr.binaryPartitionPoint{ it <= 4 } == 6
+     * assert arr.partitionPoint{ it <= 4 } == 6
      * //for all match condition
-     * assert arr.binaryPartitionPoint{ it <= 100 } == arr.size()
+     * assert arr.partitionPoint{ it <= 100 } == arr.size()
      * //for none match condition
-     * assert arr.binaryPartitionPoint{ it <= 0 } == 0
+     * assert arr.partitionPoint{ it <= 0 } == 0
      * </pre>
      *
      * @param self      a groovy arr
@@ -7046,8 +7047,8 @@ public class ArrayGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * @return an integer that is the index of the first element of the second 
partition
      * @since 5.0
      */
-    public static int binaryPartitionPoint(float[] self, DoublePredicate 
condition) {
-        return binaryPartitionPoint(self, new IntRange(0, self.length - 1), 
condition);
+    public static int partitionPoint(float[] self, DoublePredicate condition) {
+        return partitionPoint(self, new IntRange(0, self.length - 1), 
condition);
     }
 
     /**
@@ -7056,21 +7057,21 @@ public class ArrayGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * The arr is assumed to be partitioned according to the given predicate.
      * <pre class="groovyTestCase">
      * def arr = [7, 15, 3, 5, 4, 12, 6] as double[]
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it%2 != 0 } == 4
+     * assert arr.partitionPoint(0..<arr.size()) { it%2 != 0 } == 4
      * </pre>
      *
      * <pre class="groovyTestCase">
      * def arr = [1, 2, 3, 3, 4, 4, 5, 6, 7] as double[]
      * //usage case as lowerBound(cpp), bisect_left(python)
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it < 4 } == 4
+     * assert arr.partitionPoint(0..<arr.size()) { it < 4 } == 4
      * //usage case as upperBound(cpp), bisect_right(python)
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it <= 4 } == 6
+     * assert arr.partitionPoint(0..<arr.size()) { it <= 4 } == 6
      * //for all match condition
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it <= 100 } == 
arr.size()
+     * assert arr.partitionPoint(0..<arr.size()) { it <= 100 } == arr.size()
      * //for all match condition
-     * assert arr.binaryPartitionPoint(0..<arr.size()) { it <= 0 } == 0
+     * assert arr.partitionPoint(0..<arr.size()) { it <= 0 } == 0
      * //for none match condition with range
-     * assert arr.binaryPartitionPoint(2..<arr.size()) { it <= 0 } == 2
+     * assert arr.partitionPoint(2..<arr.size()) { it <= 0 } == 2
      * </pre>
      *
      * @param self      a groovy array
@@ -7079,7 +7080,7 @@ public class ArrayGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * @return an integer that is the index of the first element of the second 
partition
      * @since 5.0
      */
-    public static int binaryPartitionPoint(double[] self, IntRange intRange, 
DoublePredicate condition) {
+    public static int partitionPoint(double[] self, IntRange intRange, 
DoublePredicate condition) {
         Objects.requireNonNull(self);
         assert !intRange.isReverse();
         Objects.checkFromToIndex(intRange.getFromInt(),intRange.getToInt(), 
self.length);
@@ -7104,19 +7105,19 @@ public class ArrayGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * The arr is assumed to be partitioned according to the given predicate.
      * <pre class="groovyTestCase">
      * def arr = [7, 15, 3, 5, 4, 12, 6] as double[]
-     * assert arr.binaryPartitionPoint{ it%2 != 0 } == 4
+     * assert arr.partitionPoint{ it%2 != 0 } == 4
      * </pre>
      *
      * <pre class="groovyTestCase">
      * def arr = [1, 2, 3, 3, 4, 4, 5, 6, 7] as double[]
      * //usage case as lowerBound(cpp), bisect_left(python)
-     * assert arr.binaryPartitionPoint{ it < 4 } == 4
+     * assert arr.partitionPoint{ it < 4 } == 4
      * //usage case as upperBound(cpp), bisect_right(python)
-     * assert arr.binaryPartitionPoint{ it <= 4 } == 6
+     * assert arr.partitionPoint{ it <= 4 } == 6
      * //for all match condition
-     * assert arr.binaryPartitionPoint{ it <= 100 } == arr.size()
+     * assert arr.partitionPoint{ it <= 100 } == arr.size()
      * //for none match condition
-     * assert arr.binaryPartitionPoint{ it <= 0 } == 0
+     * assert arr.partitionPoint{ it <= 0 } == 0
      * </pre>
      *
      * @param self      a groovy arr
@@ -7124,8 +7125,8 @@ public class ArrayGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * @return an integer that is the index of the first element of the second 
partition
      * @since 5.0
      */
-    public static int binaryPartitionPoint(double[] self, DoublePredicate 
condition) {
-        return binaryPartitionPoint(self, new IntRange(0, self.length - 1), 
condition);
+    public static int partitionPoint(double[] self, DoublePredicate condition) 
{
+        return partitionPoint(self, new IntRange(0, self.length - 1), 
condition);
     }
 
     
//--------------------------------------------------------------------------
diff --git 
a/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java 
b/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
index d5a988346b..bb935c666c 100644
--- a/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
+++ b/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
@@ -132,7 +132,6 @@ import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.AbstractList;
 import java.util.ListIterator;
 import java.util.Map;
 import java.util.NavigableMap;
@@ -11050,7 +11049,7 @@ public class DefaultGroovyMethods extends 
DefaultGroovyMethodsSupport {
     }
 
     
//--------------------------------------------------------------------------
-    // binaryPartitionPoint
+    // partitionPoint
 
     /**
      * Returns the index of the partition point according to the given 
predicate
@@ -11058,21 +11057,21 @@ public class DefaultGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * The list is assumed to be partitioned according to the given predicate.
      * <pre class="groovyTestCase">
      * def list = [7, 15, 3, 5, 4, 12, 6]
-     * assert list.binaryPartitionPoint(0..<list.size()) { it%2 != 0 } == 4
+     * assert list.partitionPoint(0..<list.size()) { it%2 != 0 } == 4
      * </pre>
      *
      * <pre class="groovyTestCase">
      * def list = [1, 2, 3, 3, 4, 4, 5, 6, 7]
      * //usage case as lowerBound(cpp), bisect_left(python)
-     * assert list.binaryPartitionPoint(0..<list.size()) { it < 4 } == 4
+     * assert list.partitionPoint(0..<list.size()) { it < 4 } == 4
      * //usage case as upperBound(cpp), bisect_right(python)
-     * assert list.binaryPartitionPoint(0..<list.size()) { it <= 4 } == 6
+     * assert list.partitionPoint(0..<list.size()) { it <= 4 } == 6
      * //for all match condition
-     * assert list.binaryPartitionPoint(0..<list.size()) { it <= 100 } == 
list.size()
+     * assert list.partitionPoint(0..<list.size()) { it <= 100 } == list.size()
      * //for none match condition
-     * assert list.binaryPartitionPoint(0..<list.size()) { it <= 0 } == 0
+     * assert list.partitionPoint(0..<list.size()) { it <= 0 } == 0
      * //for none match condition with range
-     * assert list.binaryPartitionPoint(2..<list.size()) { it <= 0 } == 2
+     * assert list.partitionPoint(2..<list.size()) { it <= 0 } == 2
      * </pre>
      *
      * @param self      a groovy list
@@ -11081,7 +11080,7 @@ public class DefaultGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * @return an integer that is the index of the first element of the second 
partition
      * @since 5.0
      */
-    public static <T> int binaryPartitionPoint(AbstractList<T> self, IntRange 
intRange, Predicate<T> condition) {
+    public static <T> int partitionPoint(List<T> self, IntRange intRange, 
Predicate<T> condition) {
         Objects.requireNonNull(self);
         assert !intRange.isReverse();
         Objects.checkFromToIndex(intRange.getFromInt(),intRange.getToInt(), 
self.size());
@@ -11105,22 +11104,22 @@ public class DefaultGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * The list is assumed to be partitioned according to the given predicate.
      * <pre class="groovyTestCase">
      * def list = [7, 15, 3, 5, 4, 12, 6]
-     * assert list.binaryPartitionPoint{ it%2 != 0 } == 4
+     * assert list.partitionPoint{ it%2 != 0 } == 4
      * </pre>
      *
      * <pre class="groovyTestCase">
      * def list = [1, 2, 3, 3, 4, 4, 5, 6, 7]
      * //usage case as lowerBound(cpp), bisect_left(python)
-     * assert list.binaryPartitionPoint{ it < 4 } == 4
+     * assert list.partitionPoint{ it < 4 } == 4
      * //usage case as upperBound(cpp), bisect_right(python)
-     * assert list.binaryPartitionPoint{ it <= 4 } == 6
+     * assert list.partitionPoint{ it <= 4 } == 6
      * //for all match condition
-     * assert list.binaryPartitionPoint{ it <= 100 } == list.size()
+     * assert list.partitionPoint{ it <= 100 } == list.size()
      * //for none match condition
-     * assert list.binaryPartitionPoint{ it <= 0 } == 0
-     * //reverse logic test:
-     * assert [7, 6, 5, 4, 4, 3, 3, 2, 1].binaryPartitionPoint{ it > 4 } == 3
-     * assert [7, 6, 5, 4, 4, 3, 3, 2, 1].binaryPartitionPoint{ it >= 4 } == 5
+     * assert list.partitionPoint{ it <= 0 } == 0
+     * //predicate of reverse logic examples:
+     * assert [7, 6, 5, 4, 4, 3, 3, 2, 1].partitionPoint{ it > 4 } == 3
+     * assert [7, 6, 5, 4, 4, 3, 3, 2, 1].partitionPoint{ it >= 4 } == 5
      * </pre>
      *
      * @param self      a groovy list
@@ -11128,8 +11127,8 @@ public class DefaultGroovyMethods extends 
DefaultGroovyMethodsSupport {
      * @return an integer that is the index of the first element of the second 
partition
      * @since 5.0
      */
-    public static <T> int binaryPartitionPoint(AbstractList<T> self, 
Predicate<T> condition) {
-        return binaryPartitionPoint(self, new IntRange(0, self.size() - 1), 
condition);
+    public static <T> int partitionPoint(List<T> self, Predicate<T> condition) 
{
+        return partitionPoint(self, new IntRange(0, self.size() - 1), 
condition);
     }
 
     
//--------------------------------------------------------------------------

Reply via email to