Frequency implements Serializable { public int getUniqueCount(){ return freqTable.keySet().size(); } Frequency(); @SuppressWarnings("unchecked") // TODO is the cast OK?  Frequency(Comparator<?> comparator); @Override String toString(); void addValue(Comparable<?> v); void addValue(int v); void addValue(long v); void addValue(char v); void incrementValue(Comparable<?> v, long increment); void incrementValue(int v, long increment); void incrementValue(long v, long increment); void incrementValue(char v, long increment); void clear(); Iterator<Comparable<?>> valuesIterator(); Iterator<Map.Entry<Comparable<?>, Long>> entrySetIterator(); long getSumFreq(); long getCount(Comparable<?> v); long getCount(int v); long getCount(long v); long getCount(char v); int getUniqueCount(); double getPct(Comparable<?> v); double getPct(int v); double getPct(long v); double getPct(char v); @SuppressWarnings({ "rawtypes", "unchecked" }) long getCumFreq(Comparable<?> v); long getCumFreq(int v); long getCumFreq(long v); long getCumFreq(char v); double getCumPct(Comparable<?> v); double getCumPct(int v); double getCumPct(long v); double getCumPct(char v); List<Comparable<?>> getMode(); void merge(final Frequency other); void merge(final Collection<Frequency> others); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testGetUniqueCount() { Assert.assertEquals(0, f.getUniqueCount()); f.addValue(ONE_LONG); Assert.assertEquals(1, f.getUniqueCount()); f.addValue(ONE_LONG); Assert.assertEquals(1, f.getUniqueCount()); f.addValue(TWO); Assert.assertEquals(2, f.getUniqueCount()); }