-1

Is it possible to use a Multiset for the purpose of counting letter frequencies of the first letter in a word. Those words exist in a list.

example. [the, quick, brown, fox, jumped, over, the, lazy, dog]

Output: most common first character: [t, q, b, f, j, o, l, d]

Output: Most common first character ignoring word frequency: [t]

I just started researching how to use guava solutions.

FatFockFrank
  • 169
  • 1
  • 4
  • 17

1 Answers1

1

You'd just need to create a Multiset<Character>, then iterate over the words and add their first character to your multiset (note: there are i18n issues with this, as a general thing). You could either keep track of the most common character as you go or iterate over the multiset later to get it.

ColinD
  • 108,630
  • 30
  • 201
  • 202