Converting Map<T> to derived class
<p>I have the following class:</p>

<pre><code>class DerivedMap extends Hashmap&lt;String,Object&gt;
{}
</code></pre>

<p>Which I use because I want to implement some custom actions for this type of map.</p>

<p>I then pass instances of this class to an external api that wants Map, this naturally works well.</p>

<p>The problem is that I also get Map instances as return values from the api. Since a real object hides behind the interface that the api chose I know I cannot just cast it.</p>

<p>So, how do I convert Map to my custom DerivedMap? Must I manually copy all the keys/values?</p>

<p>Thanks.</p>
