Filter bloom1 = BloomFactory.NewBloomInstance( numElems, pct);
for( int i = 0; i< numElems/2; ++i ) {
UUID uuid = UUID.randomUUID();
Key key = new Key(uuid.toString().getBytes() );
bloom1.add( key );
Assert.assertTrue( bloom1.membershipTest(key));
(unionMap).add( uuid.toString());
if( (i % 10000) == 0 ) {
System.out.println(" Added " + i + " elements.");
}
}
Filter bloom2 = BloomFactory.NewBloomInstance( numElems, pct);
for( int i = 0; i< numElems/2; ++i ) {
UUID uuid = UUID.randomUUID();
Key key = new Key(uuid.toString().getBytes() );
bloom2.add( key );
Assert.assertTrue( bloom2.membershipTest(key));
(unionMap).add( uuid.toString());
if( (i % 10000) == 0 ) {
System.out.println(" Added " + i + " elements.");
}
}
bloom1.or( bloom2);
for( String uuid : unionMap) {
Assert.assertTrue( bloom1.membershipTest( new Key(uuid.getBytes())));
}
}