I have this getResult() with slight variation in Input parameter. one Mapvalue as string array for one and string for anor .
But I am seeing a error:
Wont overloading support generics?
public class App
{
public void getResult(Map<String, String[]> map) {
}
public void getResult(Map<String, String> map) {
}
}
I am seeing this error:Method getResult(Map) has the same erasure getResult(Map) as another method in type App
I guess java is treating both as just Maps and so is this error.
what is best approach to mimic this behaviour?
Thanks
One of the rules of overloading is that methods with type parameters cannot have the same signature after erasure. See the Java Language Specification, §8.4.8.3. The relevant text from the spec is: