vendredi 21 avril 2017

Place object class instead of generic type

Is it possible to create a List storing elements, which are objects of class of another object? What I mean is: is it possible to make something like that, but with successful compilation?

private SomeRow row = getRow();  // method getRow returns 
                                 // different classes, which extends SomeRow

List<row.class> rows;  // how is it possible to make something like that?

The problem is that in Selenium WebDriver, which I am using, it is impossible to use wildcards, so it is forbidden to do like this List<? extends SomeRow>.

Does anybody have some ideas how to do this? Or tell me if it is impossible at all, please.





Aucun commentaire:

Enregistrer un commentaire