I am sure that I have a silly bug but I am unable to pass a list of objects that implements an interface to a function that requires a list of that interface.
This is the function signature:
public void add(ArrayList<PairStringInterface> data){ ... }
And this is how I am calling this function:
ArrayList<Sector> list = new ArrayList<Sector>();
add(list);
And this is the class Sector
public class Sector implements PairStringInterface { ... }
I receive an error that there isn't any suitable function for the parameters
Error:(88, 31) error: no suitable method found for add(ArrayList<Sector>)
method PairStringSpinnerAdapter.add(ArrayList<PairStringInterface>)
is not applicable (argument mismatch; ArrayList<Sector> cannot be converted to ArrayList<PairStringInterface>)
If I iterate the list and add a method to receive just one item it works.
public void add(PairStringInterface elem) { ... }
ArrayList<Sector> list = ....
for(Sector s : list){
add(s);
}