Get generic type of java.util.List

后端 未结 14 2330
广开言路
广开言路 2020-11-22 02:06

I have;

List stringList = new ArrayList();
List integerList = new ArrayList();

Is

14条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-22 02:30

    Use Reflection to get the Field for these then you can just do: field.genericType to get the type that contains the information about generic as well.

提交回复
热议问题