BloomFilter implements Serializable { @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final BloomFilter other = (BloomFilter) obj; if (this.expectedNumberOfFilterElements != other.expectedNumberOfFilterElements) { return false; } if (this.k != other.k) { return false; } if (this.bitSetSize != other.bitSetSize) { return false; } if (this.bitset != other.bitset && (this.bitset == null || !this.bitset.equals(other.bitset))) { return false; } return true; } 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 testEquals() throws UnsupportedEncodingException { System.out.println("equals"); BloomFilter instance1 = new BloomFilter(1000, 100); BloomFilter instance2 = new BloomFilter(1000, 100); for (int i = 0; i < 100; i++) { byte[] val = UUID.randomUUID().toString().getBytes("UTF-8"); instance1.add(val); instance2.add(val); } assert(instance1.equals(instance2)); assert(instance2.equals(instance1)); byte[] anotherEntryByteArray = "Another Entry".getBytes("UTF-8"); instance1.add(anotherEntryByteArray); instance1.clear(); instance2.clear(); assert(instance1.equals(instance2)); assert(instance2.equals(instance1)); for (int i = 0; i < 100; i++) { byte[] val = UUID.randomUUID().toString().getBytes("UTF-8"); instance1.add(val); instance2.add(val); } assertTrue(instance1.equals(instance2)); assertTrue(instance2.equals(instance1)); }