title: Collection interface
body: <p>I want to create an ArrayList Object to use the Collection interface. But my code has a problem. It says </p>
  
  <p><code>I use checked and unsafe operation, please use -Xlint: unchecked to restart compile</code>.</p>
  
  <p>I want to know how to solve this problem.</p>
  
  <p>Below is my java-code:</p>
  
  <pre><code>import java.util.*;
  public class testCollection{
      public static void main(String[] args) {
          ArrayList&lt;String&gt; collection1 = new ArrayList&lt;&gt;();
          collection1.add("New York");
          collection1.add("Atalnta");
          collection1.add("Dallas");
          collection1.add("Madison");
  
          System.out.println("A list of cities in collection1:");
          System.out.println(collection1);
  
          System.out.println("\nIs Dallas in collection1?"
              +collection1.contains("Dallas"));
  
  
          Collection&lt;String&gt; collection2 = new ArrayList&lt;&gt;();
          collection2.add("Seattle");
          collection2.add("Portland");
          collection2.add("Los Angeles");
          collection2.add("Atalnta");
          System.out.println("\nA list of cities in collection2:");
          System.out.println(collection2);
  
          ArrayList&lt;String&gt; c1 = (ArrayList&lt;String&gt;)(collection1.clone());
          c1.addAll(collection2);
          System.out.println("\nCities in collection1 or collection2?");
          System.out.println(c1);
      }
  }
  </code></pre>