BloomFilter implements Serializable { @Override public int hashCode() { int hash = 7; hash = 61 * hash + (this.bitset != null ? this.bitset.hashCode() : 0); hash = 61 * hash + this.expectedNumberOfFilterElements; hash = 61 * hash + this.bitSetSize; hash = 61 * hash + this.k; return hash; } 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 testHashCode() throws UnsupportedEncodingException { System.out.println("hashCode"); BloomFilter instance1 = new BloomFilter(1000, 100); BloomFilter instance2 = new BloomFilter(1000, 100); assertTrue(instance1.hashCode() == instance2.hashCode()); for (int i = 0; i < 100; i++) { byte[] val = UUID.randomUUID().toString().getBytes("UTF-8"); instance1.add(val); instance2.add(val); } assertTrue(instance1.hashCode() == instance2.hashCode()); instance1.clear(); instance2.clear(); assertTrue(instance1.hashCode() == instance2.hashCode()); instance1 = new BloomFilter(100, 10); instance2 = new BloomFilter(100, 9); assertFalse(instance1.hashCode() == instance2.hashCode()); instance1 = new BloomFilter(100, 10); instance2 = new BloomFilter(99, 9); assertFalse(instance1.hashCode() == instance2.hashCode()); instance1 = new BloomFilter(100, 10); instance2 = new BloomFilter(50, 10); assertFalse(instance1.hashCode() == instance2.hashCode()); }