Given two instances of Type:
Type type1;
Type type2;
How to can I check if they are equal
?
I'm calling toString
and comparing their values, as such:
if (type1.toString().equals(type2.toString())) {
....
}
I tested it with multiple and nested parameterized types and so far it seems to be consistent. But I would like to know if there is a formal way to do it.
Aucun commentaire:
Enregistrer un commentaire