我想做这样的事情:
ArrayList<String> strings = new ArrayList<>();
//build a collection of Strings
callMethod(strings);
Run Code Online (Sandbox Code Playgroud)
“callMethod”是遗留的(在遗留项目中),所以我无法更改它。
它的签名是这样的:
private void callMethod(String... input){
// and so forth...
Run Code Online (Sandbox Code Playgroud)
如何将字符串集合传递给 callMethod 方法?