Ho una lista come questa:raggruppamento per Elenco dei Map in Java 8
List<Map<String, Long>>
C'è un modo, utilizzando lambda, per convertire questo elenco per:
Map<String, List<Long>>
Esempio:
Map<String, Long> m1 = new HashMap<>();
m1.put("A", 1);
m1.put("B", 100);
Map<String, Long> m2 = new HashMap<>();
m2.put("A", 10);
m2.put("B", 20);
m2.put("C", 100);
List<Map<String, Long>> beforeFormatting = new ArrayList<>();
beforeFormatting.add(m1);
beforeFormatting.add(m2);
Dopo la formattazione:
Map<String, List<Long>> afterFormatting;
che sarebbe simile:
A -> [1, 10]
B -> [100, 20]
C -> [100]
Grazie, Tunaki! :-) – test123