Suppose I have a method like below:
public void setTask(String... args) {
//...
}
How can I create a special version of the above method that has a fixed value for the first member of args
like below?
(args[0]
always has a fixed value and constructorArgs.length == args.length-1
.)
public void setSpecialTask(String... constructorArgs) {
setTask("SpecialTask", constructorArgs); // ERROR: 'setTask(java.lang.String...)' cannot be applied to '(java.lang.String, java.lang.String[])'
}
'setTask(java.lang.String...)' cannot be applied to '(java.lang.String, java.lang.String[])'