설득하기
동료와 리팩터링하다 다음과 같은 코드를 만났다.
private Map<String, Integer> getCountryCodeCountMap(String customerId) {
List<String> countries = getCountryList(customerId);
Map<String, Integer> countryCodeMap = new HashMap<>();
for (String cc : countries) {
if (StringUtils.isNotBlank(cc)) {
countryCodeMap.put(cc, countryCodeMap.getOrDefault(cc, 0) + 1);
}
}
return countryCodeMap;
}

