Error Unchecked call to 'put(K, V)' as a member of raw type 'java.util.HashMap'
38,353
Solution 1
Looks like you are missing the types.
Something like
new HashMap<Type1,Type2>().put(K,V)
should work.
Solution 2
For anonymous use:
new HashMap<Type1,Type2>().put(K,V);
For initializing a variable:
HashMap<Type1,Type2> hashMap = new HashMap<>();
hashMap.put(K,V);
Author by
user3297875
Updated on November 19, 2020Comments
-
user3297875 over 3 years
I am getting the error:
Unchecked call to 'put(K, V)' as a member of raw type 'java.util.HashMap'
This is the line that shows the error:
JSONArray FieldValues = new JSONArray(new JSONObject(new HashMap().put(K, V)));
Am I doing anything wrong or is there something I should add? any help is greatly appreciated