title: Drools - using accumulate to find min and max
body: <p>I have a drools question which has been troubling me for some time. I want to find out the min and max price from a list of Item objects (contains price) using accumulate. A Member object (which contails list of Item objects) is inserted which contains the list of Items.</p>
  
  <pre><code>groovy/java source pseudo code
  -------------------------------
  class Item {
     BigDecimal price
  }
  
  class Member {
     List&lt;Item&gt;&gt; items
  }
  
  ...
  droolsStatefulSession.insert(member)
  session.fireAllRules()
  ...
  
  rule.drl
  ---------
  rule "rule1"
  when 
     member : Member ($itemList : items)
  /*
  
  */
  then
   System.out.println("condition met...")
  end
  </code></pre>
  
  <p>Now the questions is in the above rule is it possible to if so how do I find out the item with the minimum Price and maximum price using drools accumulate feature. I do not want to use an java/groovy utility functions.</p>
  
  <p>I see the "collect" feature allows to use "from" and then a datasource. I wonder if "accumulate" is similar to collect.</p>