Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
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
- relates to
-
GROOVY-10982 Provide missing identity closure CountBy variants
- Closed
- links to