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

matlab - How to equate a structure array to structure array -

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -