@Override
    public StateObj evaluateRules(final StateObj state) {
        MutableStateObj dataState = States.mutable();
        getRuleSet().stream()
                    //filter rules that apply given the state
                    .filter(i -> i.test(state))
                    //evaluate the applicable rules
                    .map(input -> Optional.ofNullable(input.evaluate(state)))
                    //exclude empty results
                    .flatMap(o -> o.map(Stream::of).orElseGet(Stream::empty))
                    //update the state with each result
                    .forEach(dataState::updateState);
        return dataState;
    }
@ Override public StateObj evaluateRules ( final StateObj state ) { MutableStateObj dataState = States . mutable ( ) ; getRuleSet ( ) . stream ( ) . filter ( i -> i . test ( state ) ) . map ( input -> Optional . ofNullable ( input . evaluate ( state ) ) ) . flatMap ( o -> o . map ( Stream :: of ) . orElseGet ( Stream :: empty ) ) . forEach ( dataState :: updateState ) ; return dataState ; }
Evaluate each rule, if it applies, accrue the new state changes

@param state input state

@return accrued state changes from matching rules