I want to write a generic function which deserialise a generic type List with Gson here is the code:
private List GetListFromFile(String f
There is no way to do it without passing actual type of T (as Class) to your method.
But if you pass it explicitly, you can create a TypeToken for List as follows:
private List GetListFromFile(String filename, Class elementType) {
...
TypeToken> token = new TypeToken>() {};
List something = gson.fromJson(data, token.getType());
...
}
See also: