Vocabulary implements Iterable<String>, Serializable { public Integer count(String word) { Integer actualCount = this.wordCounts.get(word); if (actualCount == null) { actualCount = 0; } return actualCount; } Vocabulary();  Vocabulary(List<String> words); void add(String word); void addAll(List<String> words); void limitWords(Integer maxWords); Integer count(String word); Double frequency(String word); Boolean contains(String word); Integer wordCount(); Integer totalCount(); @Override Iterator<String> iterator(); Set<String> wordSet(); @Override String toString();  }
@Test public void testCount() { Vocabulary vocabulary = new Vocabulary(); vocabulary.add("only one"); vocabulary.add("we are 2"); vocabulary.add("we are 2"); assertEquals(1, vocabulary.count("only one").intValue()); assertEquals(2, vocabulary.count("we are 2").intValue()); assertEquals(0, vocabulary.count("I'm not here").intValue()); }