class SortFunction extends BaseFEELFunction {

    public FEELFnResult<List<Object>> invoke(@ParameterName( "ctx" ) EvaluationContext ctx,
                                             @ParameterName("list") List list,
                                             @ParameterName("precedes") FEELFunction function) {
        if ( function == null ) {
            return invoke( list );
        } else {
            return invoke(list, (a, b) -> {
                final Object result = function.invokeReflectively(ctx, new Object[]{a, b});
                if (!(result instanceof Boolean) || ((Boolean) result)) {
                    return -1;
                } else {
                    return 1;
                }
            } );
        }
    }

    public  SortFunction();

}