code: 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);
      }
docs: Determines if an object has an expected type in a null-safe way.
  
  @param expectedClass
  Expected type.
  @param obj
  Object to test.
  
  @return TRUE if the object is exactly of the same class, else FALSE.