I am able to assign the Hash-map values to List double[] using following code, but for each entry in the Hash-map, it is creating separate array.
ArrayList<HashMap<String, Double[]>> arl =(ArrayList<HashMap<String, Double[]>>)pd.getArrayList();
while (itr.hasNext()) {
HashMap< String,Double[]> map = (HashMap<String,Double[]>) itr.next();
empid.add((Double[])map.get("id"));
}
How do I get all the entries into single array of double[].
You're making the same mistake again. You need to add Double to list, not arrays of Double. So similarly to what I said in your previous question , change your code like this:
empid.addAll(Arrays.asList(map.get("id"))));
To get array from the list after the list is fully built with values from your map:
Double[] arrayOfDoubles = empid.toArray(new Double[]{});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.