package generics.variant;

import java.util.ArrayList;
import java.util.List;

class City {
}

class Province {
    List<City> cities;

    public Province(List<City> in) {
        this.cities = in;
    }
}

interface IEntityInfo {
    int type = 0;

    List<IEntityInfo> getChildren();
}


class RecyclerViewAdapter {
    List<IEntityInfo> data;

    public void setData(List<IEntityInfo> raw) {
        for (IEntityInfo parent : raw) {
            data.add(parent);
            for (IEntityInfo child : parent.getChildren()) {
                data.add(child);
            }
        }
    }
}


class Demo {
    public static void main(String[] args) {
        City london = new City();
        City toronto = new City();
        List<City> onCities = new ArrayList<>();
        onCities.add(london);
        onCities.add(toronto);
        Province on = new Province(onCities);

        List<Province> provinces = new ArrayList<>();
        provinces.add(on);


        RecyclerViewAdapter adapter = new RecyclerViewAdapter();
        adapter.setData(provinces);
    }
}
@@ -87,178 +87,418 @@
 ity 
-%7B%0A%7D%0A%0Aclass Province %7B%0A    List%3CCity%3E cities;%0A%0A    public Province(List%3CCity%3E in) %7B%0A        this.cities = in;%0A    %7D%0A%7D%0A%0Ainterface IEntityInfo %7B%0A    int type = 0;%0A%0A    List%3C
+implements IEntityInfo%7B%0A    @Override%0A    public List%3CIEntityInfo%3E getChildren() %7B%0A        return null;%0A    %7D%0A%7D%0A%0Aclass Province implements IEntityInfo %7B%0A    List%3CCity%3E cities;%0A%0A    public Province(List%3CCity%3E in) %7B%0A        this.cities = in;%0A    %7D%0A%0A    @Override%0A    public List%3C? extends IEntityInfo%3E getChildren() %7B// change here%0A        return this.cities;%0A    %7D%0A%7D%0A%0Ainterface IEntityInfo %7B%0A    List%3C? extends 
 IEnt
@@ -520,16 +520,31 @@
 ldren();
+ // change here
 %0A%7D%0A%0A%0Acla

fix one error