question: public static < T > Optional < T > cast ( Object object , Class < T > clazz ) { requireNonNull ( clazz ) ; if ( object == null ) { return Optional . empty ( ) ; } if ( clazz . isAssignableFrom ( object . getClass ( ) ) ) { final T result = clazz . cast ( object ) ; return Optional . of ( result ) ; } return Optional . empty ( ) ; }
target:  Casts and returns the provided object if it is assignable from the given class, otherwise returns an Optional.empty().