src/main/java/io/reactivex/internal/functions/Functions.java
public static <T, U> Function<T, U> castFunction(Class<U> target) {
        return new CastToClass<T, U>(target);
    }
public static <T, U> Function<T, U> castFunction(Class<U> target) {
        return new CastToClass<T, U>(target);
    }
Returns a function that cast the incoming values via a Class object.
@param <T> the input value type
@param <U> the output and target type
@param target the target class
@return the new Function instance