BloomFilter implements Serializable { public synchronized int count() { return this.numberOfAddedElements; } BloomFilter(double c, int n, int k);  BloomFilter(int bitSetSize, int expectedNumberOElements);  BloomFilter(double falsePositiveProbability, int expectedNumberOfElements);  BloomFilter(int bitSetSize, int expectedNumberOfFilterElements, int actualNumberOfFilterElements, BitSet filterData); @Override boolean equals(Object obj); @Override int hashCode(); double expectedFalsePositiveProbability(); double getFalsePositiveProbability(double numberOfElements); double getFalsePositiveProbability(); int getK(); synchronized void clear(); synchronized void add(byte[] bytes); synchronized boolean contains(byte[] bytes); synchronized boolean getBit(int bit); synchronized void setBit(int bit, boolean value); synchronized BitSet getBitSet(); synchronized int size(); synchronized int count(); int getExpectedNumberOfElements(); double getExpectedBitsPerElement(); double getBitsPerElement();  }
@Test public void testCount() throws UnsupportedEncodingException { System.out.println("count"); int expResult = 100; BloomFilter instance = new BloomFilter(0.01, expResult); for (int i = 0; i < expResult; i++) { byte[] bytes = new byte[100]; r.nextBytes(bytes); instance.add(bytes); } int result = instance.count(); assertEquals(expResult, result); instance = new BloomFilter(0.01, expResult); for (int i = 0; i < expResult; i++) { instance.add(UUID.randomUUID().toString().getBytes("UTF-8")); } result = instance.count(); assertEquals(expResult, result); }