Claudenw commented on a change in pull request #258: URL: https://github.com/apache/commons-collections/pull/258#discussion_r805173690
########## File path: src/main/java/org/apache/commons/collections4/bloomfilter/SimpleHasher.java ########## @@ -0,0 +1,169 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.commons.collections4.bloomfilter; + +import java.util.Objects; +import java.util.function.IntPredicate; + +/** + * A Hasher that implements combinatorial hashing as as described by + * <a href="https://www.eecs.harvard.edu/~michaelm/postscripts/tr-02-05.pdf">Krisch and Mitzenmacher</a>. + * <p> + * Common use for this hasher is to generate a byte array as the output of a hashing + * or MessageDigest algorithm.</p> + * + * @since 4.5 + */ +public final class SimpleHasher implements Hasher { + /** + * A default increment used when the requested increment is zero. This is the same + * default increment used in Java's SplittableRandom random number generator. It is the + * fractional representation of the golden ratio (0.618...) with a base of 2^64. + */ + public static final long DEFAULT_INCREMENT = 0x9e3779b97f4a7c15L; Review comment: remove it and added a public method called `getDefaultIncrement()` so that this implementation can be dropped into environments where a different default was selected by simply overloading that method. Documented such in method. -- 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]
