title: How to convert a object arraylist into a hashmap where key and value are the objects attributes
body: <p>I have a object arraylist like below </p>
  
  <pre><code>List&lt;Model&gt; list= new ArrayList&lt;Model&gt;();
  </code></pre>
  
  <p>The Model object has two attributes where both are integers.</p>
  
  <ol>
  <li>id </li>
  <li>count</li>
  </ol>
  
  <p>Now I want to convert this arraylist into a Hash Map where id is the key and count is the value:</p>
  
  <pre><code>Map&lt;Integer,Integer&gt; convertedmap=new  HashMap&lt;Integer,Integer&gt;();
  </code></pre>
  
  <p>Any help is appreciated?</p>