aherbert commented on code in PR #358:
URL: 
https://github.com/apache/commons-collections/pull/358#discussion_r1015794910


##########
src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilter.java:
##########
@@ -245,16 +268,43 @@ default int estimateUnion(final BloomFilter other) {
     /**
      * Estimates the number of items in the intersection of this Bloom filter 
with the other bloom filter.
      *
-     * <p>By default this is the {@code estimateN() + other.estimateN() - 
estimateUnion(other)} </p>
+     * <p>This method produces estimate is roughly equivalent to the number of 
unique Hashers that have been merged into both
+     * of the filters by rounding the value from the calculation described in 
the {@code Shape} class javadoc.</p>
      *
-     * <p>This produces estimate is roughly equivalent to the number of unique 
Hashers that have been merged into both
-     * of the filters.</p>
+     * <p><em>{@code estimateIntersection} should only be called with Bloom 
filters of the same Shape.  If called on Bloom
+     * filters of differing shape this method is not symmetric. If {@code 
other} has more bits an {@code IllegalArgumentException}
+     * may be thrown.</em></p>
      *
      * @param other The other Bloom filter
-     * @return an estimate of the number of items in the intersection.
+     * @return an estimate of the number of items in the intersection. If the 
calculated estimate is larger than Integer.MAX_VALUE then MAX_VALUE is returned.
+     * @throws IllegalArgumentException if the estimated N for the union of 
the filters is infinite.
+     * @see #estimateN()
+     * @see Shape
      */
     default int estimateIntersection(final BloomFilter other) {
         Objects.requireNonNull(other, "other");
-        return estimateN() + other.estimateN() - estimateUnion(other);
+        double eThis = getShape().estimateN(cardinality());
+        double eOther = getShape().estimateN(other.cardinality());
+        long estimate = 0L;
+        if (Double.isInfinite(eThis) && Double.isInfinite(eOther)) {
+            // if both are infinite the union is infinite and we return 
Integer.MAX_VALUE
+            return Integer.MAX_VALUE;
+        }
+        // if one is infinite the intersection is the other.
+        if (Double.isInfinite(eThis)) {
+            estimate = Math.round( eOther );

Review Comment:
   Remove surrounding whitespace `(eOther)`



##########
src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilter.java:
##########
@@ -245,16 +268,43 @@ default int estimateUnion(final BloomFilter other) {
     /**
      * Estimates the number of items in the intersection of this Bloom filter 
with the other bloom filter.
      *
-     * <p>By default this is the {@code estimateN() + other.estimateN() - 
estimateUnion(other)} </p>
+     * <p>This method produces estimate is roughly equivalent to the number of 
unique Hashers that have been merged into both
+     * of the filters by rounding the value from the calculation described in 
the {@code Shape} class javadoc.</p>
      *
-     * <p>This produces estimate is roughly equivalent to the number of unique 
Hashers that have been merged into both
-     * of the filters.</p>
+     * <p><em>{@code estimateIntersection} should only be called with Bloom 
filters of the same Shape.  If called on Bloom
+     * filters of differing shape this method is not symmetric. If {@code 
other} has more bits an {@code IllegalArgumentException}
+     * may be thrown.</em></p>
      *
      * @param other The other Bloom filter
-     * @return an estimate of the number of items in the intersection.
+     * @return an estimate of the number of items in the intersection. If the 
calculated estimate is larger than Integer.MAX_VALUE then MAX_VALUE is returned.
+     * @throws IllegalArgumentException if the estimated N for the union of 
the filters is infinite.
+     * @see #estimateN()
+     * @see Shape
      */
     default int estimateIntersection(final BloomFilter other) {
         Objects.requireNonNull(other, "other");
-        return estimateN() + other.estimateN() - estimateUnion(other);
+        double eThis = getShape().estimateN(cardinality());
+        double eOther = getShape().estimateN(other.cardinality());
+        long estimate = 0L;
+        if (Double.isInfinite(eThis) && Double.isInfinite(eOther)) {
+            // if both are infinite the union is infinite and we return 
Integer.MAX_VALUE
+            return Integer.MAX_VALUE;
+        }
+        // if one is infinite the intersection is the other.
+        if (Double.isInfinite(eThis)) {
+            estimate = Math.round( eOther );
+        } else if (Double.isInfinite(eOther)) {
+            estimate = Math.round( eThis );
+        } else {
+            BloomFilter union = this.copy();
+            union.merge(other);
+            double eUnion = getShape().estimateN(union.cardinality());
+            if (Double.isInfinite(eUnion)) {
+                throw new IllegalArgumentException( "The estimated N for the 
union of the filters is infinite");

Review Comment:
   Remove whitespace after `(`



##########
src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilter.java:
##########
@@ -245,16 +268,43 @@ default int estimateUnion(final BloomFilter other) {
     /**
      * Estimates the number of items in the intersection of this Bloom filter 
with the other bloom filter.
      *
-     * <p>By default this is the {@code estimateN() + other.estimateN() - 
estimateUnion(other)} </p>
+     * <p>This method produces estimate is roughly equivalent to the number of 
unique Hashers that have been merged into both
+     * of the filters by rounding the value from the calculation described in 
the {@code Shape} class javadoc.</p>
      *
-     * <p>This produces estimate is roughly equivalent to the number of unique 
Hashers that have been merged into both
-     * of the filters.</p>
+     * <p><em>{@code estimateIntersection} should only be called with Bloom 
filters of the same Shape.  If called on Bloom
+     * filters of differing shape this method is not symmetric. If {@code 
other} has more bits an {@code IllegalArgumentException}
+     * may be thrown.</em></p>
      *
      * @param other The other Bloom filter
-     * @return an estimate of the number of items in the intersection.
+     * @return an estimate of the number of items in the intersection. If the 
calculated estimate is larger than Integer.MAX_VALUE then MAX_VALUE is returned.
+     * @throws IllegalArgumentException if the estimated N for the union of 
the filters is infinite.
+     * @see #estimateN()
+     * @see Shape
      */
     default int estimateIntersection(final BloomFilter other) {
         Objects.requireNonNull(other, "other");
-        return estimateN() + other.estimateN() - estimateUnion(other);
+        double eThis = getShape().estimateN(cardinality());
+        double eOther = getShape().estimateN(other.cardinality());
+        long estimate = 0L;
+        if (Double.isInfinite(eThis) && Double.isInfinite(eOther)) {
+            // if both are infinite the union is infinite and we return 
Integer.MAX_VALUE
+            return Integer.MAX_VALUE;
+        }
+        // if one is infinite the intersection is the other.
+        if (Double.isInfinite(eThis)) {
+            estimate = Math.round( eOther );
+        } else if (Double.isInfinite(eOther)) {
+            estimate = Math.round( eThis );
+        } else {
+            BloomFilter union = this.copy();
+            union.merge(other);
+            double eUnion = getShape().estimateN(union.cardinality());
+            if (Double.isInfinite(eUnion)) {
+                throw new IllegalArgumentException( "The estimated N for the 
union of the filters is infinite");
+            }
+            // all estimated values are small values greater than 0 but less 
that number of bits
+            estimate = Math.round( eThis + eOther - eUnion );

Review Comment:
   Surrounding whitespace



##########
src/main/java/org/apache/commons/collections4/bloomfilter/Shape.java:
##########
@@ -36,6 +36,49 @@
  * <dd>{@code k = round((m / n) * ln(2))}</dd>
  * </dl>
  *
+ * <h2>Estimations from cardinality based on shape</h2>
+ *
+ * <p>Several estimates can be calculated from the Shape and the cardinality 
of a Bloom filter.</p>
+ *
+ * <p>In the calculation below the following values are used:</p>
+ * <ul>
+ * <li>double c = the cardinality of the Bloom filter.</li>
+ * <li>double m = numberOfBits as specified in the shape.</li>
+ * <li>double k = numberOfHashFunctions as specified in the shape.</li>
+ * </ul>
+ *
+ * <h3>Estimate N - n()</h3>
+ *
+ * <p>The calculation for the estimate of N is: {@code -(m/k) * ln( 1 - 
(c/m))}.  This is the calculation
+ * performed by the {@code Shape.estimateN(cardinality)} method below.  This 
estimates is roughly equivalent to the
+ * number of hashers that have been merged into a filter to create the 
cardinality specified.</p>
+ *
+ * <p><em>Note:</em></p>
+ * <ul>
+ * <li> if cardinality == numberOfBits, then result is infinity.</li>

Review Comment:
   `<li>if` on this line and the next



##########
src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilter.java:
##########
@@ -214,26 +215,48 @@ default boolean isFull() {
      * <p>By default this is the rounding of the {@code 
Shape.estimateN(cardinality)} calculation for the
      * shape and cardinality of this filter.</p>
      *
-     * <p>This produces an estimate roughly equivalent to the number of 
Hashers that have been merged into the filter.</p>
+     * <p>This produces an estimate roughly equivalent to the number of 
Hashers that have been merged into the filter
+     * by rounding the value from the calculation described in the {@code 
Shape} class javadoc.</p>
      *
-     * @return an estimate of the number of items in the bloom filter.
+     * <p><em>Note:</em></p>
+     * <ul>
+     * <li> if cardinality == numberOfBits, then result is 
Integer.MAX_VALUE.</li>
+     * <li> if cardinality &gt; numberOfBits, then an IllegalArgumentException 
is thrown.</li>
+     * </ul>
+     *
+     * @return an estimate of the number of items in the bloom filter.  Will 
return Integer.MAX_VALUE if the
+     * estimate is larger than Integer.MAX_VALUE.
+     * @throws IllegalArgumentException if the cardinality is &gt; 
numberOfBits as defined in Shape.
      * @see Shape#estimateN(int)
+     * @see Shape
      */
     default int estimateN() {
-        return (int) Math.round(getShape().estimateN(cardinality()));
+        double d = getShape().estimateN(cardinality());
+        if (Double.isInfinite(d)) {
+            return Integer.MAX_VALUE;
+        }
+        if (Double.isNaN(d)) {
+            throw new IllegalArgumentException("Cardinality too large: 
"+cardinality());
+        }
+        long l = Math.round(d);
+        return l>Integer.MAX_VALUE?Integer.MAX_VALUE:(int) l;

Review Comment:
   Add whitespace: `l > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) l;`



##########
src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilter.java:
##########
@@ -214,26 +215,48 @@ default boolean isFull() {
      * <p>By default this is the rounding of the {@code 
Shape.estimateN(cardinality)} calculation for the
      * shape and cardinality of this filter.</p>
      *
-     * <p>This produces an estimate roughly equivalent to the number of 
Hashers that have been merged into the filter.</p>
+     * <p>This produces an estimate roughly equivalent to the number of 
Hashers that have been merged into the filter
+     * by rounding the value from the calculation described in the {@code 
Shape} class javadoc.</p>
      *
-     * @return an estimate of the number of items in the bloom filter.
+     * <p><em>Note:</em></p>
+     * <ul>
+     * <li> if cardinality == numberOfBits, then result is 
Integer.MAX_VALUE.</li>
+     * <li> if cardinality &gt; numberOfBits, then an IllegalArgumentException 
is thrown.</li>
+     * </ul>
+     *
+     * @return an estimate of the number of items in the bloom filter.  Will 
return Integer.MAX_VALUE if the
+     * estimate is larger than Integer.MAX_VALUE.
+     * @throws IllegalArgumentException if the cardinality is &gt; 
numberOfBits as defined in Shape.
      * @see Shape#estimateN(int)
+     * @see Shape
      */
     default int estimateN() {
-        return (int) Math.round(getShape().estimateN(cardinality()));
+        double d = getShape().estimateN(cardinality());
+        if (Double.isInfinite(d)) {
+            return Integer.MAX_VALUE;
+        }
+        if (Double.isNaN(d)) {
+            throw new IllegalArgumentException("Cardinality too large: 
"+cardinality());

Review Comment:
   Add whitespace around the `+` char



##########
src/test/java/org/apache/commons/collections4/bloomfilter/AbstractBloomFilterTest.java:
##########
@@ -227,21 +227,35 @@ public void testClear() {
     }
 
     /**
-     * Tests that the andCardinality calculations are correct.
+     * Tests that the estimated intersection calculations are correct.
      */
     @Test
     public final void testEstimateIntersection() {
 
         final BloomFilter bf = createFilter(getTestShape(), from1);
         final BloomFilter bf2 = createFilter(getTestShape(), bigHasher);
+        final BloomFilter bf3 = createFilter(getTestShape(), fullHasher);
 
         assertEquals(1, bf.estimateIntersection(bf2));
         assertEquals(1, bf2.estimateIntersection(bf));
-
-        final BloomFilter bf3 = createEmptyFilter(getTestShape());
-
-        assertEquals(0, bf.estimateIntersection(bf3));
-        assertEquals(0, bf3.estimateIntersection(bf));
+        assertEquals(1, bf.estimateIntersection(bf3));
+        assertEquals(1, bf2.estimateIntersection(bf));
+        assertEquals(2, bf3.estimateIntersection(bf2));
+
+        final BloomFilter bf4 = createEmptyFilter(getTestShape());
+
+        assertEquals(0, bf.estimateIntersection(bf4));
+        assertEquals(0, bf4.estimateIntersection(bf));
+
+        // test split to union
+        HasherCollection firstHalf = new HasherCollection(new 
IncrementingHasher(0, 1)/* 0-16 */,
+                new IncrementingHasher(17, 1)/* 17-33 */, new 
IncrementingHasher(33, 1)/* 33-49 */);
+                // test split to union
+        HasherCollection secondHalf = new HasherCollection(new 
IncrementingHasher(50, 1)/* 50-66 */,
+                        new IncrementingHasher(67, 1)/* 67-83 */);
+        BloomFilter bf5 = createFilter( getTestShape(), firstHalf);

Review Comment:
   Whitespace after `(` (and also the same issue on the next line)



##########
src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilter.java:
##########
@@ -214,26 +215,48 @@ default boolean isFull() {
      * <p>By default this is the rounding of the {@code 
Shape.estimateN(cardinality)} calculation for the
      * shape and cardinality of this filter.</p>
      *
-     * <p>This produces an estimate roughly equivalent to the number of 
Hashers that have been merged into the filter.</p>
+     * <p>This produces an estimate roughly equivalent to the number of 
Hashers that have been merged into the filter
+     * by rounding the value from the calculation described in the {@code 
Shape} class javadoc.</p>
      *
-     * @return an estimate of the number of items in the bloom filter.
+     * <p><em>Note:</em></p>
+     * <ul>
+     * <li> if cardinality == numberOfBits, then result is 
Integer.MAX_VALUE.</li>
+     * <li> if cardinality &gt; numberOfBits, then an IllegalArgumentException 
is thrown.</li>
+     * </ul>
+     *
+     * @return an estimate of the number of items in the bloom filter.  Will 
return Integer.MAX_VALUE if the
+     * estimate is larger than Integer.MAX_VALUE.
+     * @throws IllegalArgumentException if the cardinality is &gt; 
numberOfBits as defined in Shape.
      * @see Shape#estimateN(int)
+     * @see Shape
      */
     default int estimateN() {
-        return (int) Math.round(getShape().estimateN(cardinality()));
+        double d = getShape().estimateN(cardinality());
+        if (Double.isInfinite(d)) {
+            return Integer.MAX_VALUE;
+        }
+        if (Double.isNaN(d)) {
+            throw new IllegalArgumentException("Cardinality too large: 
"+cardinality());
+        }
+        long l = Math.round(d);
+        return l>Integer.MAX_VALUE?Integer.MAX_VALUE:(int) l;
     }
 
     /**
      * Estimates the number of items in the union of this Bloom filter with 
the other bloom filter.
      *
-     * <p>By default this is the {@code estimateN()} of the merging of this 
filter with the {@code other} filter.</p>
-     *
      * <p>This produces an estimate roughly equivalent to the number of unique 
Hashers that have been merged into either
-     * of the filters.</p>
+     * of the filters by rounding the value from the calculation described in 
the {@code Shape} class javadoc.</p>

Review Comment:
   `{@link Shape`



##########
src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilter.java:
##########
@@ -245,16 +268,43 @@ default int estimateUnion(final BloomFilter other) {
     /**
      * Estimates the number of items in the intersection of this Bloom filter 
with the other bloom filter.
      *
-     * <p>By default this is the {@code estimateN() + other.estimateN() - 
estimateUnion(other)} </p>
+     * <p>This method produces estimate is roughly equivalent to the number of 
unique Hashers that have been merged into both
+     * of the filters by rounding the value from the calculation described in 
the {@code Shape} class javadoc.</p>

Review Comment:
   `{@link Shape`



##########
src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilter.java:
##########
@@ -245,16 +268,43 @@ default int estimateUnion(final BloomFilter other) {
     /**
      * Estimates the number of items in the intersection of this Bloom filter 
with the other bloom filter.
      *
-     * <p>By default this is the {@code estimateN() + other.estimateN() - 
estimateUnion(other)} </p>
+     * <p>This method produces estimate is roughly equivalent to the number of 
unique Hashers that have been merged into both
+     * of the filters by rounding the value from the calculation described in 
the {@code Shape} class javadoc.</p>
      *
-     * <p>This produces estimate is roughly equivalent to the number of unique 
Hashers that have been merged into both
-     * of the filters.</p>
+     * <p><em>{@code estimateIntersection} should only be called with Bloom 
filters of the same Shape.  If called on Bloom
+     * filters of differing shape this method is not symmetric. If {@code 
other} has more bits an {@code IllegalArgumentException}
+     * may be thrown.</em></p>
      *
      * @param other The other Bloom filter
-     * @return an estimate of the number of items in the intersection.
+     * @return an estimate of the number of items in the intersection. If the 
calculated estimate is larger than Integer.MAX_VALUE then MAX_VALUE is returned.
+     * @throws IllegalArgumentException if the estimated N for the union of 
the filters is infinite.
+     * @see #estimateN()
+     * @see Shape
      */
     default int estimateIntersection(final BloomFilter other) {
         Objects.requireNonNull(other, "other");
-        return estimateN() + other.estimateN() - estimateUnion(other);
+        double eThis = getShape().estimateN(cardinality());
+        double eOther = getShape().estimateN(other.cardinality());
+        long estimate = 0L;
+        if (Double.isInfinite(eThis) && Double.isInfinite(eOther)) {
+            // if both are infinite the union is infinite and we return 
Integer.MAX_VALUE
+            return Integer.MAX_VALUE;
+        }
+        // if one is infinite the intersection is the other.
+        if (Double.isInfinite(eThis)) {
+            estimate = Math.round( eOther );
+        } else if (Double.isInfinite(eOther)) {
+            estimate = Math.round( eThis );

Review Comment:
   Remove surrounding whitespace



##########
src/main/java/org/apache/commons/collections4/bloomfilter/Shape.java:
##########
@@ -36,6 +36,49 @@
  * <dd>{@code k = round((m / n) * ln(2))}</dd>
  * </dl>
  *
+ * <h2>Estimations from cardinality based on shape</h2>
+ *
+ * <p>Several estimates can be calculated from the Shape and the cardinality 
of a Bloom filter.</p>
+ *
+ * <p>In the calculation below the following values are used:</p>
+ * <ul>
+ * <li>double c = the cardinality of the Bloom filter.</li>
+ * <li>double m = numberOfBits as specified in the shape.</li>
+ * <li>double k = numberOfHashFunctions as specified in the shape.</li>
+ * </ul>
+ *
+ * <h3>Estimate N - n()</h3>
+ *
+ * <p>The calculation for the estimate of N is: {@code -(m/k) * ln( 1 - 
(c/m))}.  This is the calculation
+ * performed by the {@code Shape.estimateN(cardinality)} method below.  This 
estimates is roughly equivalent to the

Review Comment:
   `This estimate` (no estimates)



##########
src/main/java/org/apache/commons/collections4/bloomfilter/Shape.java:
##########
@@ -36,6 +36,49 @@
  * <dd>{@code k = round((m / n) * ln(2))}</dd>
  * </dl>
  *
+ * <h2>Estimations from cardinality based on shape</h2>
+ *
+ * <p>Several estimates can be calculated from the Shape and the cardinality 
of a Bloom filter.</p>
+ *
+ * <p>In the calculation below the following values are used:</p>
+ * <ul>
+ * <li>double c = the cardinality of the Bloom filter.</li>
+ * <li>double m = numberOfBits as specified in the shape.</li>
+ * <li>double k = numberOfHashFunctions as specified in the shape.</li>
+ * </ul>
+ *
+ * <h3>Estimate N - n()</h3>
+ *
+ * <p>The calculation for the estimate of N is: {@code -(m/k) * ln( 1 - 
(c/m))}.  This is the calculation

Review Comment:
   Remove whitespace: `ln( 1 -` to `ln(1 -`



##########
src/main/java/org/apache/commons/collections4/bloomfilter/Shape.java:
##########
@@ -36,6 +36,49 @@
  * <dd>{@code k = round((m / n) * ln(2))}</dd>
  * </dl>
  *
+ * <h2>Estimations from cardinality based on shape</h2>
+ *
+ * <p>Several estimates can be calculated from the Shape and the cardinality 
of a Bloom filter.</p>
+ *
+ * <p>In the calculation below the following values are used:</p>
+ * <ul>
+ * <li>double c = the cardinality of the Bloom filter.</li>
+ * <li>double m = numberOfBits as specified in the shape.</li>
+ * <li>double k = numberOfHashFunctions as specified in the shape.</li>
+ * </ul>
+ *
+ * <h3>Estimate N - n()</h3>
+ *
+ * <p>The calculation for the estimate of N is: {@code -(m/k) * ln( 1 - 
(c/m))}.  This is the calculation
+ * performed by the {@code Shape.estimateN(cardinality)} method below.  This 
estimates is roughly equivalent to the
+ * number of hashers that have been merged into a filter to create the 
cardinality specified.</p>
+ *
+ * <p><em>Note:</em></p>
+ * <ul>
+ * <li> if cardinality == numberOfBits, then result is infinity.</li>
+ * <li> if cardinality &gt; numberOfBits, then result is NaN.</li>
+ * </ul>
+ *
+ * <h3>Estimate N of Union - n(A &cup; B)</h3>
+ *
+ * <p>To estimate the number of items in the union of two Bloom filters with 
the same shape, merge them together and
+ * calculate the estimated N from the result.</p>
+ *
+ * <h3>Estimate N of the Intersection - n(A &cap; B)</h3>
+ *
+ * <p>To estimate the number of items in the intersection of two Bloom filters 
A and B with the same shape the calculation is:
+ * n(A) + n(b) - n( A &cup; B )

Review Comment:
   `n(A &cup; B)`



##########
src/test/java/org/apache/commons/collections4/bloomfilter/AbstractBloomFilterTest.java:
##########
@@ -227,21 +227,35 @@ public void testClear() {
     }
 
     /**
-     * Tests that the andCardinality calculations are correct.
+     * Tests that the estimated intersection calculations are correct.
      */
     @Test
     public final void testEstimateIntersection() {
 
         final BloomFilter bf = createFilter(getTestShape(), from1);
         final BloomFilter bf2 = createFilter(getTestShape(), bigHasher);
+        final BloomFilter bf3 = createFilter(getTestShape(), fullHasher);
 
         assertEquals(1, bf.estimateIntersection(bf2));
         assertEquals(1, bf2.estimateIntersection(bf));
-
-        final BloomFilter bf3 = createEmptyFilter(getTestShape());
-
-        assertEquals(0, bf.estimateIntersection(bf3));
-        assertEquals(0, bf3.estimateIntersection(bf));
+        assertEquals(1, bf.estimateIntersection(bf3));
+        assertEquals(1, bf2.estimateIntersection(bf));
+        assertEquals(2, bf3.estimateIntersection(bf2));
+
+        final BloomFilter bf4 = createEmptyFilter(getTestShape());
+
+        assertEquals(0, bf.estimateIntersection(bf4));
+        assertEquals(0, bf4.estimateIntersection(bf));
+
+        // test split to union
+        HasherCollection firstHalf = new HasherCollection(new 
IncrementingHasher(0, 1)/* 0-16 */,
+                new IncrementingHasher(17, 1)/* 17-33 */, new 
IncrementingHasher(33, 1)/* 33-49 */);
+                // test split to union

Review Comment:
   Indentation of this comment is wrong



##########
src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilter.java:
##########
@@ -214,26 +215,48 @@ default boolean isFull() {
      * <p>By default this is the rounding of the {@code 
Shape.estimateN(cardinality)} calculation for the
      * shape and cardinality of this filter.</p>
      *
-     * <p>This produces an estimate roughly equivalent to the number of 
Hashers that have been merged into the filter.</p>
+     * <p>This produces an estimate roughly equivalent to the number of 
Hashers that have been merged into the filter
+     * by rounding the value from the calculation described in the {@code 
Shape} class javadoc.</p>

Review Comment:
   `{@link Shape`



##########
src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilter.java:
##########
@@ -214,26 +215,48 @@ default boolean isFull() {
      * <p>By default this is the rounding of the {@code 
Shape.estimateN(cardinality)} calculation for the
      * shape and cardinality of this filter.</p>
      *
-     * <p>This produces an estimate roughly equivalent to the number of 
Hashers that have been merged into the filter.</p>
+     * <p>This produces an estimate roughly equivalent to the number of 
Hashers that have been merged into the filter
+     * by rounding the value from the calculation described in the {@code 
Shape} class javadoc.</p>
      *
-     * @return an estimate of the number of items in the bloom filter.
+     * <p><em>Note:</em></p>
+     * <ul>
+     * <li> if cardinality == numberOfBits, then result is 
Integer.MAX_VALUE.</li>

Review Comment:
   `<li>if` on this line and the next



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to