Error Unchecked call to 'put(K, V)' as a member of raw type 'java.util.HashMap' Error Unchecked call to 'put(K, V)' as a member of raw type 'java.util.HashMap' arrays arrays

Error Unchecked call to 'put(K, V)' as a member of raw type 'java.util.HashMap'


Looks like you are missing the types.

Something like

new HashMap<Type1,Type2>().put(K,V)

should work.


For anonymous use:

new HashMap<Type1,Type2>().put(K,V);

For initializing a variable:

HashMap<Type1,Type2> hashMap = new HashMap<>();hashMap.put(K,V);


It is not defined what type of data your HashMap will store. Example:

Map<String, Object> hospedajeUpload = new HashMap<>();

In this example I assign the type String and Object.