public class TestClass {
public int typeOfList(List<?> list) {
//If list equal List<AModel> then return 151
//If list equal List<BModel> then return 39
//If list equal List<CModel> then return 816
}
}
I'm trying to understand the difference between generics and wildcards but that confused me because I think generics and wildcards are mostly the same, I read a lot of articles that compare generics and wildcards but am still a little bit confused, Can someone explain the difference?
In the above code, I want to pass the unknown list type and return the int according to the list type.