groovy
  1. groovy
  2. GROOVY-5407

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

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.6
    • Fix Version/s: 2.0-beta-3, 1.8.7
    • Component/s: groovy-jdk
    • Labels:
      None
    • Number of attachments :
      0

      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.

        Activity

        Hide
        Paul King added a comment -

        Added. Thanks for the suggestion Peter.

        Show
        Paul King added a comment - Added. Thanks for the suggestion Peter.

          People

          • Assignee:
            Paul King
            Reporter:
            Peter Niederwieser
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: