Q:

How do I do the equivalent of "myClass[].class" with ArrayList?

I'm using the GSON library and calling the fromJson() method:
http://google-gson.googlecode.com/svn/tags/1.2.3/docs/javadocs/com/google/gson/Gson.html
My old code:
String s = new GsonBuilder().create().fromJson(responseString,myClass[].class);

Works fine, but I'm moving the collection from an array to an ArrayList and I can't figure out the syntax to use to pass the type to this method. If I understand correctly the existing code is passing the type (an array of myClass objects) to the method, which it then creates from the JSON response.
But I have tried all the syntax combinations I can think of and I'm stumped for how to do what I thought would look like this:
String s = new GsonBuilder().create().fromJson(responseString, ArrayList<myClass>.class );

A:

In Gson, you use a TypeToken to represent a generic type. Note the {} in there; it's necessary because it creates a subclass of TypeToken with the generic type information.
List<MyClass> list = new Gson().fromJson(responseString, 
    new TypeToken<ArrayList<MyClass>>(){}.getType());

