title: No suitable method found for ArrayList<String> .toArray(String[]::new) in return statement
body: <p>I am working on the site <a href="https://codingbat.com" rel="noreferrer">Codingbat</a>, specifically this method in AP-1</p>
  
  <pre><code>public String[] wordsWithout(String[] words, String target) {
    ArrayList&lt;String&gt; al = new ArrayList&lt;&gt;(Arrays.asList(words));
    al.removeIf(s -&gt; s.equals(target));
    return al.toArray(new String[al.size()]);
  }
  </code></pre>
  
  <p>This implementation works, and its what is currently submitted, but when I change the return statement to</p>
  
  <pre><code>return al.toArray(String[]::new);
  </code></pre>
  
  <p>which should work as far as I know, gives the following error:</p>
  
  <pre><code>no suitable method found for toArray((size)-&gt;ne[...]size])
  method java.util.Collection.&lt;T&gt;toArray(T[]) is not applicable
    (cannot infer type-variable(s) T
      (argument mismatch; Array is not a functional interface))
  method java.util.List.&lt;T&gt;toArray(T[]) is not applicable
    (cannot infer type-variable(s) T
      (argument mismatch; Array is not a functional interface))
  method java.util.AbstractCollection.&lt;T&gt;toArray(T[]) is not applicable
    (cannot infer type-variable(s) T
      (argument mismatch; Array is not a functional interface))
  method java.util.ArrayList.&lt;T&gt;toArray(T[]) is not applicable
    (cannot infer type-variable(s) T
      (argument mismatch; Array is not a functional interface)) line:4
  </code></pre>
  
  <p>Would anyone be so kind as to explain why this doesn't work?</p>