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

sum, min and friends should work on the same types that collect, each and their friends work on.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.5.1
    • 1.5.5, 1.6-beta-1
    • None
    • None

    Description

      [1,2,3].sum() works nicely.

      But [1,2,3].iterator().sum() fails.

      In contrast, this code

      [1,2,3].iterator().each {
      println it
      }

      works just fine.

      On aesthetic grounds, there shouldn't be any difference in what works and what doesn't. More importantly, there are situations where an iterator is available (due to pre-existing API's) but a collection is not.

      Attachments

        1. Groovy2560Bug.groovy
          0.5 kB
          Ted Dunning

        Activity

          People

            paulk Paul King
            tdunning@veoh.com Ted Dunning
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: