Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
public class ListOfPairsJava9 {
public static void main(String[] args) {
final Map<String, List<String>> values = new HashMap<>();
values.put("a", Arrays.asList("1", "2", "3"));
values.put("b", Arrays.asList("4", "5", "6"));
values.put("c", Collections.singletonList("7"));
final List<Map.Entry<String, String>> result = values
(pairs, entry) -> pairs.addAll(entry
.map(value -> Map.entry(entry.getKey(), value))
System.out.println("result = " + result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment