Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-2839

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

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.5.6, 1.6-beta-1
    • None
    • syntax
    • None

    Description

      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

      Attachments

        Activity

          People

            Unassigned Unassigned
            mingfai Mingfai Ma
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: