J
Juergen Berchtel
In the following lines of code I get this compiler error (getUnits):
Type mismatch: cannot convert from ArrayList<TestGen.Unit> to
List<TestGen.UnitI>
public class TestGen {
public UnitI getUnit() {
return new Unit();
}
public List<UnitI> getUnits() {
return new ArrayList<Unit>();
}
public interface UnitI { }
public class Unit implements UnitI {
}
}
The conversation works well with one object in getUnit() but I can't
convert the generics list.
Thanks for any help
Juergen
Type mismatch: cannot convert from ArrayList<TestGen.Unit> to
List<TestGen.UnitI>
public class TestGen {
public UnitI getUnit() {
return new Unit();
}
public List<UnitI> getUnits() {
return new ArrayList<Unit>();
}
public interface UnitI { }
public class Unit implements UnitI {
}
}
The conversation works well with one object in getUnit() but I can't
convert the generics list.
Thanks for any help
Juergen