Is it possible to get the number of type parameters a class has/accepts in Java using its instance? For example,
Map<String, Integer> s = new HashMap<>();
int numParams = getNumOfTypeParameters(s); // Should return 2
I know that due to type erasure we can't get the type of these parameters but can we also not get the number of parameters?