How do I cast a HashMap to a concrete class?
<p>I have a class, lets call it Fruit, and I have a HashMap. I want to be able to initialize a new instance of Fruit, but set to the values in HashMap. So for example:</p>

<pre><code>Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
map.put("name", "Banana");
map.put("color", "Yellow");
</code></pre>

<p>Then I want to be initialize a new Fruit instance like so:</p>

<pre><code>Fruit myFruit = new Fruit(map);
</code></pre>

<p>or</p>

<pre><code>Fruit myFruit = (Fruit)map;
</code></pre>

<p>Is this possible in Java, by means of iterating the Map?</p>
