I am trying to solve the problem of creating a List in runtime. I created method
private <GT, LT> LT getList(Class<GT> genericType, Class<LT> listLype) throws Exception {
Constructor<LT> c = listLype.getConstructor();
...
???
}
where LT - type of List I want to create (ArrayList, LinkedList, etc), and GT - generic type of List. How can I createLT<GT>
List? Thanks for any help.
Aucun commentaire:
Enregistrer un commentaire