Differentiating between two methods with same name but different parameter list when passing null value

Viewed 307

I have two methods in the same class with fallowing signatures:

public class Clazz{
   public void foo(String);
   public void foo(List<String>);
}

When calling methods of this function:

Clazz clazz = new Clazz();
clazz.foo(null);

Clazz::foo is obviously ambiguous because both foo methods can have null as arguments. Is there a way to differentiate between this two? Btw, I need them both to have the same name.

0 Answers
Related