I’m trying to assign Hashmap values of Double[] to List, but it is throwing an error:
“The method add(Double) in the type List is not applicable for the arguments
(Double[])”
ArrayList<HashMap<String, Double[]>> arl = (ArrayList<HashMap<String, Double[]>>) pd.getArrayList();
List<Double> empid = new ArrayList<Double>();
Iterator itr = arl.iterator();
while (itr.hasNext()) {
HashMap<String, Double[]> map = (HashMap<String, Double[]>) itr.next();
empid.add(map.get("id")));
}
How can I cast Double[] to Double.Request?
What you seem to be looking is this line:
changed to this:
It will convert an array of
Doubleto aListofDouble, andaddAllwill add all items from the resulting collection to your target collectionempid.