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

Make DGM.first() and DGM.last() work with any Iterable

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8.6
    • 2.0-beta-3, 1.8.7
    • groovy-jdk
    • None

    Description

      Currently, these methods only work with lists and arrays. This should be generalized to Iterables. In particular, first() would be very handy for Sets (which may be ordered or contain just a single element). This would put an end to the infamous set.iterator().next() idiom.

      Attachments

        Activity

          People

            paulk Paul King
            pniederw Peter Niederwieser
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: