Converting ArrayList to HashMap
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/4138364/java-how-to-convert-list-to-map">Java: How to convert List to Map</a>  </p>
</blockquote>



<p>I have arrayList</p>

<pre><code>ArrayList&lt;Product&gt; productList  = new ArrayList&lt;Product&gt;();
 productList  = getProducts();  //Fetch the result from db
</code></pre>

<p>I want to convert to ArrayList to HashMap Like this</p>

<pre><code>  HashMap&lt;String, Product&gt; s= new HashMap&lt;String,Product&gt;();
</code></pre>

<p>Please help me how to convert to HashMap.</p>
