Why doesn't this compile? I want to know the underlying reason.
If
List<String>
is not the same type as
List<Integer>
why
public String convert(List<String> strings) { return null; }
and
public String convert(List<Integer> strings) { return null; }
make an ambiguous declaration?
public class Converter {
public void why() {
List<String> strings = null;
List<Integer> integers = null;
strings = integers; // type mismatch
}
public String convert(List<String> strings) {
// error: why is this ambiguous ?
return null;
}
public String convert(List<Integer> strings) {
// error: why is this ambiguous ?
return null;
}
}