History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: GROOVY-2839
Type: New Feature New Feature
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Mingfai Ma
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
groovy

Provide a find or findAll interface that take a parameter to limit the number of result, similar to the SQL LIMIT keyword

Created: 19/May/08 06:27 AM   Updated: 19/May/08 06:27 AM
Component/s: syntax
Affects Version/s: 1.6-beta-1, 1.5.6
Fix Version/s: None

Time Tracking:
Not Specified


 Description  « Hide
Currently, the find() method return the first matched result, findAll() returns all matched result. It's suggested to have an interface that take a "limit" parameter to limit the maximum number of return records.
  • find() (or findAll()) to take a "limit" integer to decide how many records shall be returned.
    e.g. [1,2,3,4].findAll(2){it>1} == [2,3]
  • Groovy 1.x doesn't support "break" in the closure.

Also refer to the discussion at:
http://www.nabble.com/Groovy-syntax--API-enhancement-td16796998.html#a16810531



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.