Class CollectListAccumulateFunction

  • All Implemented Interfaces:
    java.io.Externalizable, java.io.Serializable, org.kie.api.runtime.rule.AccumulateFunction<CollectListAccumulateFunction.CollectListData>

    public class CollectListAccumulateFunction
    extends AbstractAccumulateFunction<CollectListAccumulateFunction.CollectListData>

    An implementation of an accumulator capable of collecting lists of values. This is similar to the "collect" CE, but allows us to collect any value, not only facts.

    Example:

     rule "List employee names"
     when
         $names : List() from accumulate(
                 Employee( $n : firstName, $l : lastName ),
                 collectList( $n + " " + $l ) )
     then
         // do something
     end
     

    The list accepts duplications and the order of the elements in the list is not guaranteed.

    See Also:
    Serialized Form