O'Reilly logo
  • Shayne Riley thinks this is interesting:

This is the preferred way to use the instanceof operator with generic types:

// Legitimate use of raw type - instanceof operator
if (o instanceof Set) {       // Raw type
    Set<?> m = (Set<?>) o;    // Wildcard type
    ...
}

From

Cover of Effective Java, 2nd Edition

Note

Thanks, type erasure!