You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2022/01/12 05:19:56 UTC
[groovy] branch GROOVY_3_0_X updated: GROOVY-6837: prep work (backport relevant part of tests and some javadoc wording only)
This is an automated email from the ASF dual-hosted git repository.
paulk pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/GROOVY_3_0_X by this push:
new 73e0845 GROOVY-6837: prep work (backport relevant part of tests and some javadoc wording only)
73e0845 is described below
commit 73e08451ea2ab30bc25e45d5d2ada07aa0da9165
Author: Paul King <pa...@asert.com.au>
AuthorDate: Wed Jan 12 15:19:47 2022 +1000
GROOVY-6837: prep work (backport relevant part of tests and some javadoc wording only)
---
.../groovy/runtime/DefaultGroovyMethods.java | 40 +++++++++++++++++++---
1 file changed, 36 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java b/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
index 8323ac5..b47fb41 100644
--- a/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
+++ b/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
@@ -13714,11 +13714,22 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
}
/**
- * Create an array composed of the elements of the first array minus the
+ * Create a new array composed of the elements of the first array minus the
* elements of the given Iterable.
+ * <pre class="groovyTestCase">
+ * Integer[] ints = [1, 2, 3, 1]
+ * List<Integer> nope = [1, 3]
+ * def result = ints - nope
+ * assert result == new Integer[]{2}
+ *
+ * Integer[] none = []
+ * result = none - 123
+ * assert result !== none
+ * assert result.length == 0
+ * </pre>
*
* @param self an array
- * @param removeMe a Collection of elements to remove
+ * @param removeMe an Iterable of elements to remove
* @return an array with the supplied elements removed
* @since 1.5.5
*/
@@ -13728,8 +13739,19 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
}
/**
- * Create an array composed of the elements of the first array minus the
+ * Create a new array composed of the elements of the first array minus the
* elements of the given array.
+ * <pre class="groovyTestCase">
+ * Integer[] ints = [1, 2, 3, 1]
+ * Integer[] nope = [1, 3]
+ * def result = ints - nope
+ * assert result == new Integer[]{2}
+ *
+ * Integer[] none = []
+ * result = none - 123
+ * assert result !== none
+ * assert result.length == 0
+ * </pre>
*
* @param self an array
* @param removeMe an array of elements to remove
@@ -13893,8 +13915,18 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
}
/**
- * Create a new object array composed of the elements of the first array
+ * Create a new array composed of the elements of the first array
* minus the element to remove.
+ * <pre class="groovyTestCase">
+ * Integer[] ints = [1, 2, 3, 1]
+ * def result = ints - 1
+ * assert result == new Integer[]{2, 3}
+ *
+ * Integer[] none = []
+ * result = none - '1'
+ * assert result !== none
+ * assert result.length == 0
+ * </pre>
*
* @param self an array
* @param removeMe an element to remove from the array