Created
September 8, 2019 09:27
-
-
Save GaneshSamarthyam/7b74a6fa5340d3ba8e87afe5e50e8f06 to your computer and use it in GitHub Desktop.
refactoring example
This file contains 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) { | |
for (String value : values) { | |
List<String> existingValues = map.get(key); | |
if (existingValues == null) { | |
existingValues = new ArrayList<String>(); | |
map.put(key, existingValues); | |
} | |
else { | |
existingValues.add(value); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment