public static boolean isExpectedType ( final Class < ? > expectedClass , final Object obj ) { final Class < ? > actualClass ; if ( obj == null ) { actualClass = null ; } else { actualClass = obj . getClass ( ) ; } return Objects . equals ( expectedClass , actualClass ) ; }
Determines if an object has an expected type in a null - safe way .