-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,671
  • 14
  • 52
  • 79

1 Answers1

3

This is not possible due to type erasure.

Paul Bellora
  • 53,024
  • 17
  • 128
  • 180
  • 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