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

Identity variants for DGM#countBy

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 5.0.0-alpha-4
    • None
    • None

    Description

      We haven't added such functionality in the past since it was thought to be more of a niche use case than groupBy (where we do provide it). But given this is the closest Groovy has to creating a multiset/bag, it is probably worth having as a shortcut - rather than requiring an explicit Closure.IDENTITY.

      Whether Groovy should have specialised multiset and multimap classes is another question for another issue. We could use ".toMultiset()" to return a more specialised multiset return type in that case, so we aren't making it harder with this PR to add such functionality later if we wanted.

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              paulk Paul King
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: