You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@accumulo.apache.org by David Medinets <da...@gmail.com> on 2012/09/11 18:13:14 UTC

Null parameter to BloomFilter.membershipTest

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;
  }