I have a method with List as a parameter.
private static void setData(List<IData> list) {
}
The interface IData is
public interface IData {
    int getData();
}
And i have a class named Data which implements the interface of IData
public class Data implements IData{
    @Override
    public int getData() {
        // TODO Auto-generated method stub
        return 0;
    }
}
The question is when I use the parameter of List to call method, it fails to compile.
public class Test {
    public static void main(String[] args) {
        List<Data> temp = new ArrayList<>();
        for (int i = 0; i < 5; i++) {
            temp.add(new Data());
        }
        setData(temp);
        List<IData> temp2 = new ArrayList<>();
        for (int i = 0; i < 5; i++) {
            temp2.add(new Data());
        }
        setData(temp2);
    }
    private static void setData(List<IData> list) {
    }
}
setData(temp) is error. setData(temp2) is ok. Both of the lists have same content. I don't understand.
 
     
    