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 872f16f48a GROOVY-11604: Add returnEarly boolean variant for DGM#chop
(tweak tests)
872f16f48a is described below
commit 872f16f48adce9e08e29a5880734dc57115fecfa
Author: Paul King <[email protected]>
AuthorDate: Wed Apr 9 10:44:17 2025 +1000
GROOVY-11604: Add returnEarly boolean variant for DGM#chop (tweak tests)
---
.../codehaus/groovy/runtime/DefaultGroovyMethods.java | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git
a/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
b/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
index 6f174de4e2..96c5a31d9e 100644
--- a/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
+++ b/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
@@ -1909,11 +1909,9 @@ public class DefaultGroovyMethods extends
DefaultGroovyMethodsSupport {
* <p>
* Example usage:
* <pre class="groovyTestCase">
- * import java.util.stream.Stream
- *
* def stars = ['*']
* .repeat()
- * .chop(Stream.iterate(1, n {@code ->} n + 2).iterator())
+ * .chop(Iterators.iterate(1, n {@code ->} n + 2))
* .take(10)
* *.join()
* .collect()
@@ -1949,16 +1947,14 @@ public class DefaultGroovyMethods extends
DefaultGroovyMethodsSupport {
* <p>
* Example usage:
* <pre class="groovyTestCase">
- * import java.util.stream.Stream
- *
- * def stars = ['*']
+ * def shape = Iterators.iterate(1, n {@code ->} n + 2).take(10).plus([3]
* 3)
+ * def tree = ['*']
* .repeat()
- * .chop(true, Stream.iterate(1, n {@code ->} n + 2).iterator())
- * .take(10)
+ * .chop(true, shape)
* *.join()
* .collect()
- * def width = stars[-1].size()
- * assert stars*.center(width, '.').join('\n') == '''
+ * def width = tree*.size().max()
+ * assert tree*.center(width, '.').join('\n') == '''
* .........*.........
* ........***........
* .......*****.......
@@ -1969,6 +1965,9 @@ public class DefaultGroovyMethods extends
DefaultGroovyMethodsSupport {
* ..***************..
* .*****************.
* *******************
+ * ........***........
+ * ........***........
+ * ........***........
* '''.trim()
* </pre>
*