public void add(long hashcode) {
    if (encoding.equals(EncodingType.SPARSE)) {
      if (sparseRegister.add(hashcode)) {
        invalidateCount = true;
      }

      // if size of sparse map excess the threshold convert the sparse map to
      // dense register and switch to DENSE encoding
      if (sparseRegister.isSizeGreaterThan(encodingSwitchThreshold)) {
        encoding = EncodingType.DENSE;
        denseRegister = sparseToDenseRegister(sparseRegister);
        sparseRegister = null;
        invalidateCount = true;
      }
    } else {
      if (denseRegister.add(hashcode)) {
        invalidateCount = true;
      }
    }
  }
Java's default charset will be used for strings.
@param val
         - input string
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/common/ndv/hll/HyperLogLog.java