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_4_X 36baf6cd4 -> ba98c9a45


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/ba98c9a4
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/ba98c9a4
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/ba98c9a4

Branch: refs/heads/GROOVY_2_4_X
Commit: ba98c9a451516bcfdbf695afb12b5636207c2239
Parents: 36baf6c
Author: pascalschumacher <[hidden email]>
Authored: Sat Mar 18 10:39:44 2017 +0100
Committer: pascalschumacher <[hidden email]>
Committed: Sat Mar 18 10:40:39 2017 +0100

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


http://git-wip-us.apache.org/repos/asf/groovy/blob/ba98c9a4/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 39c1cb0..3e05d73 100644
--- a/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
+++ b/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
@@ -2297,6 +2297,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
@@ -2314,6 +2318,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
@@ -2331,6 +2339,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
@@ -2375,6 +2387,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...