new ArrayList<Integer>(); giving a syntax error in Java
<p>I am trying to run the following code that I found marked as correct on StackOverflow:</p>

<p><a href="http://stackoverflow.com/questions/1073919/how-to-convert-int-into-listinteger-in-java">Code on SO</a></p>

<pre><code>List&lt;Integer&gt; intList = new ArrayList&lt;Integer&gt;();
for (int index = 0; index &lt; ints.length; index++)
{
    intList.add(ints[index]);
}
</code></pre>

<p>When I run the code I get an error: Syntax error on token ";", { expected after this token  on the line starting with List</p>

<p>Is there something I am missing?</p>
