class KiePMMLRegressionTableRegressionFactory {

    static void populateOutputFieldsMapWithResult(final BlockStmt body,
                                                  final List<KiePMMLOutputField> outputFields) {
        outputFields.stream()
                .filter(outputField -> PREDICTED_VALUE.equals(outputField.getResultFeature()))
                .forEach(outputField -> {
                    StringLiteralExpr key = new StringLiteralExpr(outputField.getName());
                    Expression value = new NameExpr("result");
                    NodeList<Expression> expressions = NodeList.nodeList(key, value);
                    body.addStatement(new MethodCallExpr(new NameExpr("outputFieldsMap"), "put", expressions));
                });
    }

    private  KiePMMLRegressionTableRegressionFactory();

}