FrequencyDistribution implements Serializable { public void clear() { freqDist.clear(); maxFreq = 0; maxSample = null; n = 0; } FrequencyDistribution();  FrequencyDistribution(Iterable<T> iterable); boolean contains(T sample); void inc(T sample); void incAll(Iterable<T> iterable); long getN(); long getB(); long getCount(T sample); @SuppressWarnings("unchecked") Set<T> getKeys(); void addSample(T sample, long number); long getMaxFreq(); T getSampleWithMaxFreq(); void save(File file); void load(File file); void clear(); List<T> getMostFrequentSamples(int n);  }
@Test public void clearTest() { List<String> tokens = Arrays .asList("This is a first test that contains a first test example".split(" ")); FrequencyDistribution<String> fd = new FrequencyDistribution<String>(); fd.incAll(tokens); fd.clear(); assertEquals(0L, fd.getMaxFreq()); assertNull(fd.getSampleWithMaxFreq()); }