我有一个ArrayList<String>
我需要传递此 ArrayList 中的每个字符串作为此函数的参数:
protected Void myFunction(String... params)
注意:我无法修改 myFunction
最佳答案
使用 toArray
将其转换为数组方法:
myList.toArray(new String[myList.size()]);
关于java - 在 Java 中将 ArrayList 作为泛型参数传递,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16299892/