title: What should be imported to create a list?
body: <p>I attempted creating a list:</p>
  
  <pre><code>List list = new ArrayList();
  </code></pre>
  
  <p>I compiled it and it said it needed something to import.
  I tried <code>import java.util.Collection;</code>
  But that doesn't do anything.</p>
  
  <p>I tried <code>java.util.List</code> but all the error messages gave me the impression that it's kinda risky.</p>
  
  <p>Here's my code so you can understand my dilemma, which is a mod of <a href="http://introcs.cs.princeton.edu/java/13flow/Factors.java.html" rel="nofollow">this code</a>:</p>
  
  <pre><code>// purpose: remodify original program such that it will not print duplicate factors. added lines are marked by //t
  
  import java.util.Collection; //???????????????? //t
  public class Factors
  {
      public static void main(String[] args) { 
  
          // command-line argument
          long n = Long.parseLong(args[0]);
          List list = new ArrayList(); //potato, attempt to create a list so that I can later modify the list such that it will delete dupes right before printing
          System.out.print("The prime factorization of " + n + " is: ");
  
          // for each potential factor i
          for (long i = 2; i*i &lt;= n; i++) {
  
              // if i is a factor of N, repeatedly divide it out
              while (n % i == 0) {
                  System.out.print(i + " "); 
                  n = n / i;
              }
              list.add(n);
          }
  
          Set set = new HashSet(list); //t, I read somewhere that this will clear the dupes
          // if biggest factor occurs only once, n &gt; 1
          if (n &gt; 1){ 
              System.out.println(set); //t, i assume it will do as expected, but right now the import error is stopping me
  
          }
          else       System.out.println();
      }
  }
  </code></pre>
  
  <p>being new to java, I did not know what the hell I was doing. Going back on this question, I believe all I had to do was <code>import java.util.ArrayList;</code> and it would work as I needed. Sorry for the trouble.</p>