Baqend / Orestes-Bloomfilter

Library of different Bloom filters in Java with optional Redis-backing, counting and many hashing options.
Other
839 stars 245 forks source link

ambiguous reference of byte[] in countingbloomfilter #23

Closed lwhite1 closed 8 years ago

lwhite1 commented 8 years ago
 private CountingBloomFilter<byte[]> cbf =
     new FilterBuilder(MAX_KEYS, 0.01).buildCountingBloomFilter();

...

cbf.remove(key)

results in a compilation error:

Error:(73, 8) java: reference to remove is ambiguous both method remove(byte[]) in orestes.bloomfilter.CountingBloomFilter and method remove(T) in orestes.bloomfilter.CountingBloomFilter match

Casting to a byte[], as below, does not help:

cbf.remove((byte[])key)

produces the same error.

Any help is appreciated.

DivineTraube commented 8 years ago

Hi,

this was indeed a problem. In 1.1.0 the raw byte[] methods now all End with *Raw so that the ambiguity problem for BloomFilter with byte[] as their generic type are gone.

As an explanation: the generic methods all map to the byte methods an use the String representation of the given object in order to derive its byte representation. So you are fine using the *Raw methods and skipping the conversion.