I have a peculiar situation where I'd like to pass a "static anonymous array" as a parameter.
For example, the function being called would look like this:
public void writeField(String[][] fielddata) { ... }
And the caller would look like this:
...
writeField( {{"id1", "name1", "label1"}, {"id2", "name2", "label2"}});
...
I can easily do this and it works:
...
writeField( new String[][]{{"id1", "name1", "label1"}, {"id2", "name2", "label2"}});
...
But I'd like to avoid the "new" calls if possible.
I'm sure you're thinking, "why?" It's an unusual situation and this really is an ideal way of solving it so please spare me the OO and type safety lesson.
Does anyone know of a way to pass a "static anonymous array" as a parameter. You can pass a static anonymous String, so why not an array? It seems like the compiler could pick up the array data type from the parameter specification of the called function.
Thanks!