BloomFilterAlt implements IFilter<E>, Serializable { @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final BloomFilterAlt<E> other = (BloomFilterAlt<E>) 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; } BloomFilterAlt(double c, int n, int k);  BloomFilterAlt(int bitSetSize, int expectedNumberOElements);  BloomFilterAlt(double falsePositiveProbability, int expectedNumberOfElements);  BloomFilterAlt(int bitSetSize, int expectedNumberOfFilterElements, int actualNumberOfFilterElements, BitSet filterData); static int createHash(String val, Charset charset); static int createHash(String val); static int createHash(byte[] data); static int[] createHashes(byte[] data, int hashes); @Override boolean equals(Object obj); @Override int hashCode(); double expectedFalsePositiveProbability(); double getFalsePositiveProbability(double numberOfElements); double getFalsePositiveProbability(); int getK(); void clear(); void add(E element); void add(byte[] bytes); double getPercentNonZero(); int getNumNonZero(); void addAll(Collection<? extends E> c); boolean membershipTest(E element); boolean contains(E element); boolean contains(byte[] bytes); boolean containsAll(Collection<? extends E> c); boolean getBit(int bit); void setBit(int bit, boolean value); BitSet getBitSet(); int size(); int count(); int getExpectedNumberOfElements(); double getExpectedBitsPerElement(); double getBitsPerElement();  }
@Test public void testEquals() throws UnsupportedEncodingException { System.out.println("equals"); BloomFilterAlt instance1 = new BloomFilterAlt(1000, 100); BloomFilterAlt instance2 = new BloomFilterAlt(1000, 100); for (int i = 0; i < 100; i++) { String val = UUID.randomUUID().toString(); instance1.add(val); instance2.add(val); } assert(instance1.equals(instance2)); assert(instance2.equals(instance1)); instance1.add("Another entry"); instance1.clear(); instance2.clear(); assert(instance1.equals(instance2)); assert(instance2.equals(instance1)); for (int i = 0; i < 100; i++) { String val = UUID.randomUUID().toString(); instance1.add(val); instance2.add(val); } assertTrue(instance1.equals(instance2)); assertTrue(instance2.equals(instance1)); }