-1

I would like to determine if an object is an instanceof a generic type. How may I do this?

something like if (someVariable instanceof E){} Thanks!

EDIT

I think I found an answer: if (getClass() != obj.getClass()) {return false;}

farm ostrich
  • 5,881
  • 14
  • 55
  • 81

1 Answers1

3

This is not possible due to type erasure.

Paul Bellora
  • 54,340
  • 18
  • 130
  • 181
  • Could the downvoter please comment? Erasure is a comprehensive limitation on the language. If you're looking for a workaround, ask and I'll edit my answer. – Paul Bellora Nov 21 '11 at 22:31