lairtech
lairtech

Reputation: 2417

Java: How to declare a List using a Class object as parameter?

I'm looking to invoke by reflection a method that returns List<X>. However, I do not have the class definition for X, so I can only get the type by reflection. What's the proper syntax for declaring List<X>, where X is a Class object?

Upvotes: 0

Views: 107

Answers (1)

Anubian Noob
Anubian Noob

Reputation: 13596

Just use List<Object>, this will work for any object.

Upvotes: 1

Related Questions