title: Convert List<Object[]> Array into Map
body: <p>I am trying to make a Hashmap out of a List of Objects[] but I am unable to do so. Below is the code that I have written:</p>
  
  <pre><code>List&lt;Object[]&gt; adjustments =  query.getResultList();
  Map&lt;Integer, BigDecimal&gt; dpaMap = adjustments.stream().collect(Collectors.toMap(a -&gt; (Integer)a[0], a -&gt; (BigDecimal)a[1]));
  </code></pre>
  
  <p>I know that only two fields are returning from the query they have the same Type as mentioned in Map, but its not working. Please guide me in this regard.</p>
  
  <p>Thanks In Advance. </p>