java - "The method put(Object, Object) in the type HashMap is not applicable for the arguments (String, boolean)" -


hm.put("billingenquiry",true); 

produces error

the method put(object, object) in type hashmap not applicable arguments   (string,boolean)".  

how resolve issue?

you're using non-parametrized hashmap. try declare hashmap this:

hashmap<string, boolean> mymap = new hashmap<string, boolean>(); 

also note cannot use primitive types in generic types. this:

hashmap<string, boolean> mymap = new hashmap<string, boolean>(); 

... incorrect , won't compile.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -