Overloading Java function with List<> parameter

前端 未结 6 1294
猫巷女王i
猫巷女王i 2021-02-02 15:19

I have 2 classes

public class Customer{
  ...
  public String getCustomerNumber();
  ...
}

public class Applicant{
   ....
   private Customer c;
   public Cust         


        
6条回答
  •  暖寄归人
    2021-02-02 15:38

    The thing about generics in Java is that generic types are erased at runtime, so both of these methods compile to the same signature. You will need to have separate method names, or check the type of the list elements at runtime.

提交回复
热议问题