would like to pass an argument of arraylist type to a method i am going to invoke.
I am hitting some syntax errors, so I was wondering what was wrong with what this.
Scenario 1:
// 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} );
Scenario 2 (not the same, but similar):
// I am passing it as a variable to GSON, same syntax error
ArrayList<AW> answers = gson.fromJson(json.toString(), ArrayList<AW>.class);
Your (main) mistake is passing unnecessary generic type
AWin yourgetMethod()arguments. I tried to write a simple code that similar to yours but working. Hopefully it may answers (some) of your question somehow :