title: How can I pass List in my method parameter?
body: <p>Can someone explain how to define a List parameter such that i can pass a List to it. My method looks something like this. I need LIST to be replaced so the method recognizes "listname" as a list. </p>
  
  <pre><code>public static void function(int number, LIST listname) {
    for (int i = 0; i &lt; listname.size(); ++i {
      System.out.print(listname.get(i) + ": ");
    }
    System.out.println(number);
  }
  </code></pre>
  
  <p>In my main method I will call on the method as such:</p>
  
  <pre><code>List&lt;String&gt; myList = new ArrayList&lt;String&gt;();
    myList.add("item1");
    myList.add("item2");
    myList.add("item3");
  
  function(4, myList);
  </code></pre>