I want to be able to write an array directly as a parameter for my method, instead of storing the array values inside a separate variable.
Example:
public void myMethod(myObject[] objParam, String[] strParam, Integer[] intParam) {
// do stuff
}
And I would like to call the method like this:
myMethod({obj1, obj2}, {"string1","string2"}, {123,456});
Currently this is not acceptable in my IDE, and I've tried different notations, even casting to arrays, however nothing works.
I don't want to have to declare and initiate an array for each of the parameters every time I need to use my method.
Does anyone know a good workaround for this? Is using List a solution?
EDIT: The parameter types are fixed, the array values will correspond 1 to 1 for each of the 3 parameters.