java - Store primitive values in an EnumMap -


why can't create enummap this:

enummap<funkytrolls, int> amountmap; 

i want count , save number of trolls of each type. way of doing this?

just use integer. generics work on objects, not on primitive types, java has auto-boxing , -unboxing.

this should work:

map<funkytrolls, integer> amountmap = new enummap<funkytrolls, integer>(); amountmap.put(funkytrolls.very_funky_troll, 100); 

Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -