accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Medinets <david.medin...@gmail.com>
Subject Null parameter to BloomFilter.membershipTest
Date Tue, 11 Sep 2012 16:13:14 GMT
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;
  }

Mime
View raw message