I get the warning:
Unchecked assignment for \'java.util.ArrayList\' to \'java.util.ArrayList < com.test.mytest >\'
for:
You want new ArrayList<>();
so that you use the right generic type. At the moment you're using the raw type on the right hand side of =
. So you want:
private ArrayList myLocations = new ArrayList<>();
Or just be explicit:
private ArrayList myLocations = new ArrayList();
(You might also consider making the type of the variable List
instead of ArrayList
, unless you're using ArrayList
-specific members. I'd also ditch the "my" prefix, personally.)