To get the List<Float>
, you can invoke the method using class literal - Float.class
:
List<Float> list = getList(someName, Float.class);
From JLS 15.8.2 - Class Literals:
A class literal is an expression consisting of the name of a class, interface, array, or primitive type, or the pseudo-type void, followed by a
'.'
and the token class.The type of
C.class
, whereC
is the name of a class, interface, or array type (§4.3), isClass<C>
.