title: Finding minimum date from a list in Drools
body: <p>I have an object "Parent" which contains a list of "Item" objects. Each "Item" has a ship date. How do I find the minimum ship date from the list of "Item" objects? I'm using Drools 6.2.0.</p>
  
  <pre><code>class Parent{
      List&lt;Item&gt; items;
      // Getter / Setter
  }
  
  class Item{
      Date shipDate();
      // Getter / Setter
  }
  </code></pre>
  
  <p>I tried coming up with a rule, but it throws an exception. I'm pretty sure I'm way off. This is what I have for now:</p>
  
  <pre><code>rule "Print min ship date"
      when
          $parent : Parent( $items:getItems() &amp;&amp; null != $items)
          $minShipDate : Date() from accumulate(($item : Item ($shipDate : getShipDate()) from $items), 
                                      min($shipDate)) 
      then
          System.out.println("Min ship date is "+minShipDate); 
  end
  </code></pre>
  
  <p>This is the exception I get:</p>
  
  <pre><code> java.lang.ClassCastException: org.drools.compiler.lang.descr.OrDescr cannot be cast to org.drools.compiler.lang.descr.PatternDescr
  </code></pre>