title: Drools: Compare 2 Arraylists from the same Object
body: <p>I have a Class and this Class constructs 7 ArrayLists:</p>
  
  <pre><code>public class Fruchtplanungsmodul {
  
      private ArrayList&lt;Crops&gt; fruchtliste1F;
      private ArrayList&lt;Crops&gt; fruchtliste2F;
      private ArrayList&lt;Crops&gt; fruchtliste3F;
      private ArrayList&lt;Crops&gt; fruchtliste4F;
      private ArrayList&lt;Crops&gt; fruchtliste5F;
      private ArrayList&lt;Crops&gt; fruchtliste6F;
      private ArrayList&lt;Crops&gt; fruchtliste7F;
  
      // Constructor
      public Fruchtplanungsmodul() {
          fruchtliste1F = new ArrayList&lt;&gt;();
          fruchtliste2F = new ArrayList&lt;&gt;();
          fruchtliste3F = new ArrayList&lt;&gt;();
          fruchtliste4F = new ArrayList&lt;&gt;();
          fruchtliste5F = new ArrayList&lt;&gt;();
          fruchtliste6F = new ArrayList&lt;&gt;();
          fruchtliste7F = new ArrayList&lt;&gt;();
      }
      functions for deleting Objects....
  }
  </code></pre>
  
  <p>And I want to load Objects in this list with Drools-rules.
  I do load the same Objecttyps into all Arraylists. For example, in this rule, I load 4 Objects Crops into the first ArrayList.</p>
  
  <pre><code>rule "Körnerlegmunosen: Planung erste Feldrigkeit"
      when
          //$grund:         Grundbedingung(grundbedingung == 1)
          $feld:          Feldrigkeit(feldrigkeit1 == "Körnerleguminosen")
          $m:             Fruchtplanungsmodul()
  
      then
  
          Crops erbse = new Crops("Erbse", "Koernerleguminose","BF", "Hafer", "Silomais", "Sommerung", 6);
          Crops ackerbohne = new Crops("Ackerbohne" , "Koernerleguminose", "BF", "Silomais", "Wintergerste", "Sommerung", 4);
          Crops lupine = new Crops("Lupine", "Koernerleguminose", "BF", "Späte Kartoffel", "Winterroggen", "Sommerung", 4);
          Crops sojabohne = new Crops("Sojabohne", "Koernerleguminose", "BF", "Futterrübe", "winterroggen", "Sommerung", 3);
  
          insert(erbse);
          insert(ackerbohne);
          insert(lupine);
          insert(sojabohne);
          $m.addFrucht1(erbse);
          $m.addFrucht1(ackerbohne);
          $m.addFrucht1(lupine);
          $m.addFrucht1(sojabohne);
  end
  </code></pre>
  
  <p>In other rules, I load different Crops into other ArrayLists from the Class Fruchtplanungsmodul().</p>
  
  <p>My Question is: Is there any way to compare Objects from different ArrayLists?</p>
  
  <p>For example, ArrayList "fruchtliste2F" has 4 objects from the type Crops and the ArrayList "fruchtliste3F" also has 4 objects from the type Crops. Now I need to check with a rule if there is one Object with the same Name in both ArrayLists. If this is true, the rule should delete the object from the second list.</p>
  
  <p>Thanks for your help!
  Philipp</p>