Java Raw Types

One thing I learnt from this is we should write instanceof generic types like this:

boolean a = (m instanceof Map<?,?>);

Oh well, before I usually suppress the warning by adding:

@SuppressWarnings("rawtypes")

or by using this:

boolean a = Map.isInstance(m);

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.