想将 arraylist 类型的参数传递给我要调用的方法。
我遇到了一些语法错误,所以我想知道这有什么问题。
场景一:
// i have a class called AW
class AW{}
// i would like to pass it an ArrayList of AW to a method I am invoking
// But i can AW is not a variable
Method onLoaded = SomeClass.class.getMethod("someMethod", ArrayList<AW>.class );
Method onLoaded = SomeClass.class.getMethod("someMethod", new Class[]{ArrayList<AnswerWrapper>.class} );
场景2(不一样,但类似):
// I am passing it as a variable to GSON, same syntax error
ArrayList<AW> answers = gson.fromJson(json.toString(), ArrayList<AW>.class);