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:
List<Object[]> adjustments = query.getResultList();
Map<Integer, BigDecimal> dpaMap = adjustments.stream().collect(Collectors.toMap(a -> (Integer)a[0], a -> (BigDecimal)a[1]));
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.
Thanks In Advance.