public static Map<String,Integer> frequencyOfListElements( List items ) {
if (items == null || items.size() == 0) return null;
Map<String, Integer> map = new HashMap<String, Integer>();
for (String temp : items) {
Integer count = map.get(temp);
map.put(temp, (count == null) ? 1 : count + 1);
}
return map;
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-06
  • 2022-12-23
  • 2022-12-23
  • 2021-05-18
  • 2019-01-10
猜你喜欢
  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案