protected static <S extends TypeScope, R> R getFirstDefinedValue(List<BiFunction<S, SchemaGenerationContext, R>> resolvers, S scope,
            SchemaGenerationContext context) {
        return resolvers.stream()
                .map(resolver -> resolver.apply(scope, context))
                .filter(Objects::nonNull)
                .findFirst()
                .orElse(null);
    }
Helper function for invoking a given function with the provided inputs or returning null, if all functions return null themselves.

@param <S> type of the targeted scope/type representation (to be forwarded as first parameter to the given function)
@param <R> type of the expected return value (of the given function)
@param resolvers functions to invoke and return the first non-null result from
@param scope targeted scope (to be forwarded as first argument to a given function)
@param context generation context enabling advanced features within the given configuration
@return return value of successfully invoked function or null
jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/SchemaGeneratorTypeConfigPart.java