How To Instantiate a java.util.ArrayList with Generic Class Using Reflection

后端 未结 6 1302
野的像风
野的像风 2020-12-10 13:37

How To Instantiate a java.util.ArrayList with Generic Class Using Reflection? I am writing a method that sets java.util.List on target object. A target object and a generic

6条回答
  •  猫巷女王i
    2020-12-10 14:06

    Generics only work at compile time, therefore if you're using reflection, they won't be available.

    See more about this here.

提交回复
热议问题