Having a data map as below :
Map<String, List<Integer>> dataMap = ....
i want to convert it to another Map
below, the solution I've tried
Map<String, int[]> dataMapOut = new HashMap<>();
dataMap.entrySet().stream().forEach(entry -> {
String key = entry.getKey();
int[] val = entry.getValue().stream().mapToInt(i -> i).toArray();
dataMapOut.put(key, val);
});
Looking for better and more concise way of mapping ?
Listwith an array? Seems like an XY problem to me.