I have the following line of code
this.htmlSpecialChars = this.getSpecialCharMap();
where
private HashMap<String,String> htmlSpecialChars;
but I get a warning about an unchecked conversion. How do I stop this warning?
You're getting this because getSpecialCharMap() is returning an object whose type cannot be verified by the compiler to be HashMap< String, String>. Go ahead and provide the prototype for getSpecialCharMap.
You are getting the warning because the compiler cannot verify that the assignment to htmlSpecialChars
is a HashMap<String,String>, since the method getSpecialChars() is returning a plain, non-generic HashMap.
You should modify your method to return the specific generic type:
private HashMap<String,String> getSpecialCharMap() {
return new HashMap<String,String>();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With