Quantcast

groovy git commit: DefaultGroovyMethods#any: add examples to javadoc

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

groovy git commit: DefaultGroovyMethods#any: add examples to javadoc

pascalschumacher
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_5_X 46a47936b -> af27ccf6f


DefaultGroovyMethods#any: add examples to javadoc


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/af27ccf6
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/af27ccf6
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/af27ccf6

Branch: refs/heads/GROOVY_2_5_X
Commit: af27ccf6fe68fa0fe4f27d0344ec0a5b96fb7d0f
Parents: 46a4793
Author: pascalschumacher <[hidden email]>
Authored: Sat Mar 18 10:39:44 2017 +0100
Committer: pascalschumacher <[hidden email]>
Committed: Sat Mar 18 10:41:09 2017 +0100

----------------------------------------------------------------------
 .../groovy/runtime/DefaultGroovyMethods.java       | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/af27ccf6/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java b/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
index 96c99d9..219226f 100644
--- a/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
+++ b/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
@@ -2432,6 +2432,10 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
     /**
      * Iterates over the contents of an object or collection, and checks whether a
      * predicate is valid for at least one element.
+     * <pre class="groovyTestCase">
+     * assert [1, 2, 3].any { it == 2 }
+     * assert ![1, 2, 3].any { it > 3 }
+     * </pre>
      *
      * @param self    the object over which we iterate
      * @param closure the closure predicate used for matching
@@ -2449,6 +2453,10 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
     /**
      * Iterates over the contents of an iterator, and checks whether a
      * predicate is valid for at least one element.
+     * <pre class="groovyTestCase">
+     * assert [1, 2, 3].iterator().any { it == 2 }
+     * assert ![1, 2, 3].iterator().any { it > 3 }
+     * </pre>
      *
      * @param self    the iterator over which we iterate
      * @param closure the closure predicate used for matching
@@ -2466,6 +2474,10 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
     /**
      * Iterates over the contents of an iterable, and checks whether a
      * predicate is valid for at least one element.
+     * <pre class="groovyTestCase">
+     * assert [1, 2, 3].any { it == 2 }
+     * assert ![1, 2, 3].any { it > 3 }
+     * </pre>
      *
      * @param self    the iterable over which we iterate
      * @param closure the closure predicate used for matching
@@ -2510,6 +2522,11 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
      * Iterates over the elements of a collection, and checks whether at least
      * one element is true according to the Groovy Truth.
      * Equivalent to self.any({element -> element})
+     * <pre class="groovyTestCase">
+     * assert [false, true].any()
+     * assert [0, 1].any()
+     * assert ![0, 0].any()
+     * </pre>
      *
      * @param self the object over which we iterate
      * @return true if any item in the collection matches the closure predicate

Loading...