HashMap<String, Integer>(); for (ArticleView articleView : articleViews) { Integer count = contributorCounts.get(articleView.contributor); if (count == null) contributorCounts.put(articleView.contributor, 1); else contributorCounts.put(articleView.contributor, count + 1); } List<ContributorCount> result = new ArrayList<ContributorCount>(); for (String contributor : contributorCounts.keySet()) { int count = contributorCounts.get(contributor); if (count > 1) result.add(new ContributorCount(contributor, contributorCounts.get(contributor))); } return result; }