diff --git a/android/guava/src/com/google/common/hash/BloomFilter.java b/android/guava/src/com/google/common/hash/BloomFilter.java index 05138fb017bd..f4fcf1f74cbd 100644 --- a/android/guava/src/com/google/common/hash/BloomFilter.java +++ b/android/guava/src/com/google/common/hash/BloomFilter.java @@ -419,11 +419,19 @@ public int hashCode() { * ensuring proper serialization and deserialization, which is important since {@link #equals} * also relies on object identity of funnels. * + *

Because a {@code BloomFilter} is backed by a single array, it can hold at most about {@code + * 64 * Integer.MAX_VALUE} bits. The number of bits required grows with {@code expectedInsertions} + * and as {@code fpp} approaches zero, so a sufficiently large {@code expectedInsertions} or small + * {@code fpp} will exceed this limit. + * * @param funnel the funnel of T's that the constructed {@code BloomFilter} will use * @param expectedInsertions the number of expected insertions to the constructed {@code * BloomFilter}; must be positive * @param fpp the desired false positive probability (must be positive and less than 1.0) * @return a {@code BloomFilter} + * @throws IllegalArgumentException if the number of bits required to hold {@code + * expectedInsertions} entries at the given {@code fpp} exceeds about {@code 64 * + * Integer.MAX_VALUE} */ public static BloomFilter create( Funnel funnel, int expectedInsertions, double fpp) { @@ -444,11 +452,19 @@ public int hashCode() { * ensuring proper serialization and deserialization, which is important since {@link #equals} * also relies on object identity of funnels. * + *

Because a {@code BloomFilter} is backed by a single array, it can hold at most about {@code + * 64 * Integer.MAX_VALUE} bits. The number of bits required grows with {@code expectedInsertions} + * and as {@code fpp} approaches zero, so a sufficiently large {@code expectedInsertions} or small + * {@code fpp} will exceed this limit. + * * @param funnel the funnel of T's that the constructed {@code BloomFilter} will use * @param expectedInsertions the number of expected insertions to the constructed {@code * BloomFilter}; must be positive * @param fpp the desired false positive probability (must be positive and less than 1.0) * @return a {@code BloomFilter} + * @throws IllegalArgumentException if the number of bits required to hold {@code + * expectedInsertions} entries at the given {@code fpp} exceeds about {@code 64 * + * Integer.MAX_VALUE} * @since 19.0 */ public static BloomFilter create( @@ -497,10 +513,16 @@ public int hashCode() { * ensuring proper serialization and deserialization, which is important since {@link #equals} * also relies on object identity of funnels. * + *

Because a {@code BloomFilter} is backed by a single array, it can hold at most about {@code + * 64 * Integer.MAX_VALUE} bits, which at the default 3% false positive probability is reached at + * roughly {@code 2e10} {@code expectedInsertions}; a larger value will exceed this limit. + * * @param funnel the funnel of T's that the constructed {@code BloomFilter} will use * @param expectedInsertions the number of expected insertions to the constructed {@code * BloomFilter}; must be positive * @return a {@code BloomFilter} + * @throws IllegalArgumentException if the number of bits required to hold {@code + * expectedInsertions} entries exceeds about {@code 64 * Integer.MAX_VALUE} */ public static BloomFilter create( Funnel funnel, int expectedInsertions) { @@ -521,10 +543,16 @@ public int hashCode() { * ensuring proper serialization and deserialization, which is important since {@link #equals} * also relies on object identity of funnels. * + *

Because a {@code BloomFilter} is backed by a single array, it can hold at most about {@code + * 64 * Integer.MAX_VALUE} bits, which at the default 3% false positive probability is reached at + * roughly {@code 2e10} {@code expectedInsertions}; a larger value will exceed this limit. + * * @param funnel the funnel of T's that the constructed {@code BloomFilter} will use * @param expectedInsertions the number of expected insertions to the constructed {@code * BloomFilter}; must be positive * @return a {@code BloomFilter} + * @throws IllegalArgumentException if the number of bits required to hold {@code + * expectedInsertions} entries exceeds about {@code 64 * Integer.MAX_VALUE} * @since 19.0 */ public static BloomFilter create( diff --git a/guava/src/com/google/common/hash/BloomFilter.java b/guava/src/com/google/common/hash/BloomFilter.java index 33f684683198..5674dea25db0 100644 --- a/guava/src/com/google/common/hash/BloomFilter.java +++ b/guava/src/com/google/common/hash/BloomFilter.java @@ -429,11 +429,19 @@ public int hashCode() { * ensuring proper serialization and deserialization, which is important since {@link #equals} * also relies on object identity of funnels. * + *

Because a {@code BloomFilter} is backed by a single array, it can hold at most about {@code + * 64 * Integer.MAX_VALUE} bits. The number of bits required grows with {@code expectedInsertions} + * and as {@code fpp} approaches zero, so a sufficiently large {@code expectedInsertions} or small + * {@code fpp} will exceed this limit. + * * @param funnel the funnel of T's that the constructed {@code BloomFilter} will use * @param expectedInsertions the number of expected insertions to the constructed {@code * BloomFilter}; must be positive * @param fpp the desired false positive probability (must be positive and less than 1.0) * @return a {@code BloomFilter} + * @throws IllegalArgumentException if the number of bits required to hold {@code + * expectedInsertions} entries at the given {@code fpp} exceeds about {@code 64 * + * Integer.MAX_VALUE} */ public static BloomFilter create( Funnel funnel, int expectedInsertions, double fpp) { @@ -454,11 +462,19 @@ public int hashCode() { * ensuring proper serialization and deserialization, which is important since {@link #equals} * also relies on object identity of funnels. * + *

Because a {@code BloomFilter} is backed by a single array, it can hold at most about {@code + * 64 * Integer.MAX_VALUE} bits. The number of bits required grows with {@code expectedInsertions} + * and as {@code fpp} approaches zero, so a sufficiently large {@code expectedInsertions} or small + * {@code fpp} will exceed this limit. + * * @param funnel the funnel of T's that the constructed {@code BloomFilter} will use * @param expectedInsertions the number of expected insertions to the constructed {@code * BloomFilter}; must be positive * @param fpp the desired false positive probability (must be positive and less than 1.0) * @return a {@code BloomFilter} + * @throws IllegalArgumentException if the number of bits required to hold {@code + * expectedInsertions} entries at the given {@code fpp} exceeds about {@code 64 * + * Integer.MAX_VALUE} * @since 19.0 */ public static BloomFilter create( @@ -507,10 +523,16 @@ public int hashCode() { * ensuring proper serialization and deserialization, which is important since {@link #equals} * also relies on object identity of funnels. * + *

Because a {@code BloomFilter} is backed by a single array, it can hold at most about {@code + * 64 * Integer.MAX_VALUE} bits, which at the default 3% false positive probability is reached at + * roughly {@code 2e10} {@code expectedInsertions}; a larger value will exceed this limit. + * * @param funnel the funnel of T's that the constructed {@code BloomFilter} will use * @param expectedInsertions the number of expected insertions to the constructed {@code * BloomFilter}; must be positive * @return a {@code BloomFilter} + * @throws IllegalArgumentException if the number of bits required to hold {@code + * expectedInsertions} entries exceeds about {@code 64 * Integer.MAX_VALUE} */ public static BloomFilter create( Funnel funnel, int expectedInsertions) { @@ -531,10 +553,16 @@ public int hashCode() { * ensuring proper serialization and deserialization, which is important since {@link #equals} * also relies on object identity of funnels. * + *

Because a {@code BloomFilter} is backed by a single array, it can hold at most about {@code + * 64 * Integer.MAX_VALUE} bits, which at the default 3% false positive probability is reached at + * roughly {@code 2e10} {@code expectedInsertions}; a larger value will exceed this limit. + * * @param funnel the funnel of T's that the constructed {@code BloomFilter} will use * @param expectedInsertions the number of expected insertions to the constructed {@code * BloomFilter}; must be positive * @return a {@code BloomFilter} + * @throws IllegalArgumentException if the number of bits required to hold {@code + * expectedInsertions} entries exceeds about {@code 64 * Integer.MAX_VALUE} * @since 19.0 */ public static BloomFilter create(