title: Can I create a list of array with Arrays.asList?
body: <p>Say I want to create a List which contains Integer[] arrays. But</p>
  
  <pre><code>Integer[] foo = {1,2,3};
  List&lt;Integer[]&gt; bar = Arrays.asList(foo);
  </code></pre>
  
  <p>The second line wouldn't compile, because <code>Arrays.asList(foo)</code> will return a List with three Integer elements(namely 1, 2, 3), not a List with a single Integer[] element.</p>
  
  <p>Since the documentation states the parameter of asList method as varargs of type T, I don't understand why the compiler doesn't interpret the second line as single argument of type Integer[] given. How do I get a List of single Array element?</p>
  
  <pre><code>List&lt;Integer[]&gt; bar = new ArrayList&lt;Integer[]&gt;(Arrays.asList(foo));
  </code></pre>
  
  <p>This is what I actually wanted to do, but it also doesn't compile, for the same reason I believe.</p>