Class CollectSetAccumulateFunction

All Implemented Interfaces:
Externalizable, Serializable, AccumulateFunction<CollectSetAccumulateFunction.CollectListData>

public class CollectSetAccumulateFunction extends AbstractAccumulateFunction<CollectSetAccumulateFunction.CollectListData>

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

Example:

 rule "Set of unique employee names"
 when
     $names : Set() from accumulate(
             Employee( $n : firstName, $l : lastName ),
             collectSet( $n + " " + $l ) )
 then
     // do something
 end
 

The set obviously does not computes duplications and the order of the elements in the set is not guaranteed.

See Also: