Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Jana McKinnon4,219 Points
For getCategoryCounts, why do we have to create a map with an Integer object rather than a primitive type int?
The task is to create a function that makes a map with categories and the amount of times they're listed. I completed the challenge after changing my map to Map<String, Integer> rather than Map<String, int>
I thought autoboxing would convert a primitive type to an object? Does that not work for Maps?
It's not a dire question, I'm just curious, thanks!
you cannot use primitive types for generic declarations like <String, Integer>. Check out this link for more information.
Kind Regards, Florian