3

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.

wdc
  • 2,623
  • 1
  • 28
  • 41

0 Answers0