How can I return the same Collection type given as a parameter, but with a different element type?
<p>I want to do this:</p>

<pre><code>public &lt;C extends Collection&lt;?&gt;&gt; C&lt;File&gt; strings_to_files(C&lt;String&gt; strings)
{
    C&lt;File&gt; files = new C&lt;File&gt;();

    for(String string : strings)
    {
        files.add(new File(string)
    }

    return files;
}
</code></pre>

<p>I just want it to take any Collection of strings, and return that same Collection type with files. Is there any way to do this? Or maybe I just have the syntax wrong...</p>