title: error: no suitable method found for add(ArrayList<Integer>) greatestCd.add(numFactors);
body: <p>I am making a fraction calculator in java for school. I am trying to find the greatest common divisor using arrays ,but I keep getting an error telling me there is no suitable method found for add(ArrayList) .Basicaly what I am trying to do is add the numbFactors arraylist and denFactors arraylist to the greatestCd arraylist.</p>
  
  <pre><code>ArrayList&lt;Integer&gt; numFactors = new ArrayList&lt;&gt;();
  ArrayList&lt;Integer&gt; denFactors = new ArrayList&lt;&gt;();
  ArrayList&lt;Integer&gt; greatestCd = new ArrayList&lt;&gt;();
  
  // reduce the fraction result.
  // find the factors of the numerator and denominator. check
  for(int i = 2; i &lt; rn +1; ++i){
      //check if the factors go evenly. check
      if (rn%i == 0){
          numFactors.add(i);
      }
  
  }
  
  //Same for denominators. check
  for(int i = 2; i &lt; rd +1; ++i){
      //check if the factors go evenly. check
      if (rd%i == 0){
          denFactors.add(i);
      }
  
  }
  //Find the greatest common divisor
  //Find the common factors
  for(int i =0; i &lt; numFactors.size(); i++){
      for(int j =0; j&lt;denFactors.size(); j++){
          if(numFactors == denFactors){
  
             greatestCd.add(numFactors);
             greatestCd.add(denFactors);
          }
  // check to see which are the same
  // if they are, add them to the third arraylist
      }
  }
  </code></pre>
  
  <p>here is the error I am getting</p>
  
  <pre><code> error: no suitable method found for add(ArrayList&lt;Integer&gt;)
                                                  greatestCd.add(numFactors);
                                                            ^
      method Collection.add(Integer) is not applicable
        (argument mismatch; ArrayList&lt;Integer&gt; cannot be converted to Integer)
      method List.add(Integer) is not applicable
        (argument mismatch; ArrayList&lt;Integer&gt; cannot be converted to Integer)
      method AbstractCollection.add(Integer) is not applicable
        (argument mismatch; ArrayList&lt;Integer&gt; cannot be converted to Integer)
      method AbstractList.add(Integer) is not applicable
        (argument mismatch; ArrayList&lt;Integer&gt; cannot be converted to Integer)
      method ArrayList.add(Integer) is not applicable
        (argument mismatch; ArrayList&lt;Integer&gt; cannot be converted to Integer)
  RodriguesP1.java:159: error: no suitable method found for add(ArrayList&lt;Integer&gt;)
  
                                                  greatestCd.add(denFactors);
                                                            ^
      method Collection.add(Integer) is not applicable
        (argument mismatch; ArrayList&lt;Integer&gt; cannot be converted to Integer)
      method List.add(Integer) is not applicable
        (argument mismatch; ArrayList&lt;Integer&gt; cannot be converted to Integer)
      method AbstractCollection.add(Integer) is not applicable
        (argument mismatch; ArrayList&lt;Integer&gt; cannot be converted to Integer)
      method AbstractList.add(Integer) is not applicable
        (argument mismatch; ArrayList&lt;Integer&gt; cannot be converted to Integer)
      method ArrayList.add(Integer) is not applicable
        (argument mismatch; ArrayList&lt;Integer&gt; cannot be converted to Integer)
  Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
  2 errors
  </code></pre>