BloomFilterAlt implements IFilter<E>, 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; } 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 testHashCode() throws UnsupportedEncodingException { System.out.println("hashCode"); BloomFilterAlt instance1 = new BloomFilterAlt(1000, 100); BloomFilterAlt instance2 = new BloomFilterAlt(1000, 100); assertTrue(instance1.hashCode() == instance2.hashCode()); for (int i = 0; i < 100; i++) { String val = UUID.randomUUID().toString(); instance1.add(val); instance2.add(val); } assertTrue(instance1.hashCode() == instance2.hashCode()); instance1.clear(); instance2.clear(); assertTrue(instance1.hashCode() == instance2.hashCode()); instance1 = new BloomFilterAlt(100, 10); instance2 = new BloomFilterAlt(100, 9); assertFalse(instance1.hashCode() == instance2.hashCode()); instance1 = new BloomFilterAlt(100, 10); instance2 = new BloomFilterAlt(99, 9); assertFalse(instance1.hashCode() == instance2.hashCode()); instance1 = new BloomFilterAlt(100, 10); instance2 = new BloomFilterAlt(50, 10); assertFalse(instance1.hashCode() == instance2.hashCode()); }