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

java - Cast from Object to List<String>: CastClassException -

How to set a border for android Imageview in Longpress? -

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