Edit Since there were many downvotes and people who didn't understand what I'm asking for, I'll rephrase:
How do I find out at runtime what is the class that foo was generified from?
public boolean doesClassImplementList(Class<?> genericClass)
{
// help me fill this in
// this method should return true if genericClass implements List
// I can't do this because it doesn't compile:
return genericClass instanceof List;
}
Class.isAssignableFrom
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With