beyondgrader.com Logo
DemoBrowseAboutTeamLogin

Map Sum Longer Than

Geoffrey Challen // 2020.11.0

Create a method named sumLongerThan. sumLongerThan accepts a Map from String to Int as its first parameter and an Int as its second. It returns the sum as an Int of the values of all of the keys that are longer than the second parameter.

For example:

If the length is negative, you should throw an IllegalArgumentException.

As a reminder, you can iterate over the values in a map like this: