|
|
-
Null parameter to BloomFilter.membershipTestDavid Medinets 2012-09-11, 16:13
What is the reasoning behind having membershipTest throw an exception
instead of return false for null parameters? public boolean membershipTest(Key key) { if (key == null) { throw new NullPointerException("key cannot be null"); } final int[] h = hash.hash(key); hash.clear(); for (int i = 0; i < nbHash; i++) { if (!bits.get(h[i])) { return false; } } return true; } |