Scala how can I count the number of occurrences in a list -
wall list = list (1,2,4,2,4,7,3,2,4)
I want to implement it like this: list.count (2)
(return 3).
The mark is count
in the archive: list.count (_ == 2)
wall list = list (1,2,4,2,4,7,3,2,4)
I want to implement it like this: list.count (2)
(return 3).
The mark is count
in the archive: list.count (_ == 2)
Comments
Post a Comment