When Java implemented generics to make bytecode backward compatible, they came up with type erasure. This means that at run time there is no general information. So the signatures are valid:
public double foo(ArrayList x); public double foo(ArrayList d);
and you have two methods with the same signature.
The solution here would be to not overload the method name; Name the two methods with different names.
Here's the Java Generics Tutorial to Erase Styles .
source share