Feature Request: Add countFrequency
method to Iterable
in the collection package
#679
Labels
countFrequency
method to Iterable
in the collection package
#679
Feature Request: Add
countFrequency
method toIterable
in the collection packageDescription
I would like to propose adding a new method
countFrequency
to theIterable
class in thecollection
package. This method would return aMap
where the keys are the unique elements from the iterable, and the values are the counts of those elements.Motivation
A built-in method to count the frequency of elements in an iterable simplifies common tasks that developers often need to implement manually. This addition will enhance the
collection
package's usability and convenience, providing a standard way to perform this operation.Proposed Implementation
Add the following extension to
lib/src/iterable_extensions.dart
:Example Usage
If you agree, I can open a PR with code and tests for all Iterable subclasses including Edge Cases.
The text was updated successfully, but these errors were encountered: