Hi I want to override constructor in custom class MyList.
Code below can be compiled, I receive "same erasure" error. For compiler List<CustomClass1>
is same type as List<CustomClass2>
Can someone suggest me how to solve this. I try using List<Object>
and using instanceof
but I can't solve this but without success
private static class MyList {
private int type;
public MyList (List<CustomClass1> custom1) {
type = 1;
}
public MyList (List<CustomClass2> custom2) {
type = 2;
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…