sclass HFlagsWithCount { new MultiSet countryMultiSet; Map countriesByCount; S headStuff() { ret hcss_flags(); } void addCountry(S country) { if (nempty(country)) countryMultiSet.add(country); } S html() { countriesByCount = sortedByValue(countryMultiSet.asMap()); ret joinWithSpace( map(countriesByCount, (country, n) -> div("", class := "iti__flag iti__" + lower(country), style := "display: inline-block", title := makeTitle(country, n)) + appendBracketedCountUnlessOne(n))); } S makeTitle(S country, int n) { ret nVisitors(n) + " from " + country; } }