| <?xml version="1.0" encoding="UTF-8"?> |
| <document url="CollectionExtensions.html"> |
| <!-- |
| WARNING: This file is automatically generated from a jsdoc processor that |
| turns javadoc-type comments of Javascript and special Java files into an xml file, which is |
| then processed by an xsl file to create this document. Do not modify this |
| file, but rather either modify the comments or xsl file. |
| --> |
| <properties> |
| <title>java.util.Collection Extensions</title> |
| </properties> |
| <body> |
| <section href="summary" name="java.util.Collection Extensions"> |
| <p>Adds various function extensions to java.util.List implementations.</p> |
| <dl/> |
| <table width="100%"> |
| <tr> |
| <th colspan="2">Property Summary</th> |
| </tr> |
| <tr> |
| <td width="5%"> |
| <code>int</code> |
| </td> |
| <td> |
| <strong> |
| <code> |
| <a href="#prop_length">length</a> |
| </code> |
| </strong> |
| <dd>Provides the current size of the collection.</dd> |
| </td> |
| </tr> |
| </table> |
| <br/> |
| <table width="100%"> |
| <tr> |
| <th colspan="2">Function Summary</th> |
| </tr> |
| <tr> |
| <td width="5%"> |
| <code>void</code> |
| </td> |
| <td> |
| <strong> |
| <code> |
| <a href="#fn_each">each(Function func)</a> |
| </code> |
| </strong> |
| <dd>Iterates through the collection and for each element, calls the passed function with the element as the parameter.</dd> |
| </td> |
| </tr> |
| <tr> |
| <td width="5%"> |
| <code>Object</code> |
| </td> |
| <td> |
| <strong> |
| <code> |
| <a href="#fn_find">find(Function func)</a> |
| </code> |
| </strong> |
| <dd>Finds the first item selected by the passed function.</dd> |
| </td> |
| </tr> |
| <tr> |
| <td width="5%"> |
| <code>java.util.List</code> |
| </td> |
| <td> |
| <strong> |
| <code> |
| <a href="#fn_findAll">findAll(Function func)</a> |
| </code> |
| </strong> |
| <dd>Finds all items selected by the passed function.</dd> |
| </td> |
| </tr> |
| </table> |
| </section> |
| <section name="Properties"> |
| <section href="prop_length" name="length"> |
| <pre>int length</pre> |
| <p>Provides the current size of the collection. Alternative to the size() method to be more consistent with Javascript arrays.</p> |
| </section> |
| </section> |
| <section name="Functions"> |
| <section href="fn_each" name="each"> |
| <pre>void each(Function func)</pre> |
| <p>Iterates through the collection and for each element, calls the passed function with the element as the parameter.</p> |
| <dl> |
| <dt> |
| <strong>Example: </strong> |
| </dt> |
| <dd> |
| <pre>list.each(function(item) { print(item) })</pre> |
| </dd> |
| </dl> |
| </section> |
| <section href="fn_find" name="find"> |
| <pre>Object find(Function func)</pre> |
| <p>Finds the first item selected by the passed function. The function will receive the item and should return true or false for the result.</p> |
| <dl> |
| <dt> |
| <strong>Example: </strong> |
| </dt> |
| <dd> |
| <pre>item = list.find(function(item) { return item.matches(/foo[0-9]/) })</pre> |
| </dd> |
| </dl> |
| </section> |
| <section href="fn_findAll" name="findAll"> |
| <pre>java.util.List findAll(Function func)</pre> |
| <p>Finds all items selected by the passed function. The function will receive the item and should return true or false for the result. A list of all matches will be returned.</p> |
| <dl> |
| <dt> |
| <strong>Example: </strong> |
| </dt> |
| <dd> |
| <pre>matches = list.findAll(function(item) { return item.matches(/foo[0-9]/) })</pre> |
| </dd> |
| </dl> |
| </section> |
| </section> |
| </body> |
| </document> |