I prefer not to use SuppressWarnings. I prefer to write code that produces no complaints. I import the apache.commons class PropertiesConfiguration.
This file was created with a text editor:
numbers = 0.222,0.333
animals = dog,cat
I then read the file into an instance of PropertiesConfiguration, say it is referenced by “pc”.
List<String> myStringList = pc.getList("animals");
The call to getList() produces a compile-time warning about unchecked conversions. How do I improve this without SupressWarnings?
It looks like
getList()returns a genericListobject. How about usinggetStringArray()instead which returns an array ofStrings?