Is there any way to make this code more concise so as not to have so many overloaded methods?
public void method(String[] args1, String[] args2){}
public void method(String[] args1, String args2){}
public void method(String args1, String[] args2){}
public void method(String args1, String args2){}
The number of overloaded methods increases exponentially as the number of arguments increases. This is obviously a problem, and I know there has to be an easier way to do this.
The goal is to find the best way to pass any number of objects of the same type as an argument without using an array for single-object input.
Why? It's for simplicity for the end programmer.
public <T> void method(T... args)what you're looking for?