title: How to add list( array of strings) and arrayList using collections?
body: <p>I am trying to add an array of strings to an arrayList . Below is the code:</p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.List;
  import java.util.Collections;
  import java.util.Arrays;
  
  class AddAll{
      public static void main(String[] args){
          String[] words = {"apples","beef","corn","ham"};
          List&lt;String&gt; list = Arrays.asList(words);
  
          ArrayList&lt;String&gt; arrayList = new ArrayList&lt;String&gt;();
          arrayList.add("Youtube");
          arrayList.add("Google");
          arrayList.add("Facebook");
  
          for(String x : arrayList){
          System.out.printf("%s ",x);
          }
          System.out.println();
  
          Collections.addAll(arrayList,list);
  
        for(String x : arrayList){
          System.out.printf("%s ",x);
      }
    }
   }
  </code></pre>
  
  <p>However, during compilation it throws below error. I am not able to figure out how to resolve it? Can someone help me with this code?</p>
  
  <pre><code>  AddAll.java:21: error: method addAll in class Collections cannot be applied to           given types;
      Collections.addAll(arrayList,list);
                 ^
    required: Collection&lt;? super T&gt;,T[]
     found: ArrayList&lt;String&gt;,List&lt;String&gt;
    reason: inferred type does not conform to upper bound(s)
    inferred: List&lt;String&gt;
     upper bound(s): String,Object
     where T is a type-variable:
      T extends Object declared in method &lt;T&gt;addAll(Collection&lt;? super T&gt;,T...)
  </code></pre>
  
  <p>1 error</p>