Last active
September 8, 2019 10:51
-
-
Save GaneshSamarthyam/385b1660e64feceb84c950bdab40e0fa to your computer and use it in GitHub Desktop.
Refactored solution for appendMapEntries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Helper function to append values if not already present in the Map | |
protected void appendMapEntries(Map<String, List<String>> map, String key, List<String> values) { | |
values.forEach(value -> map.computeIfAbsent(key, k -> new ArrayList<>()).add(value)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment