Claudenw commented on a change in pull request #258: URL: https://github.com/apache/commons-collections/pull/258#discussion_r804889347
########## File path: src/main/java/org/apache/commons/collections4/bloomfilter/hasher/filter/Filter.java ########## @@ -0,0 +1,89 @@ +/* + * 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.hasher.filter; + +import java.util.function.IntPredicate; + +import org.apache.commons.collections4.bloomfilter.BitMap; +import org.apache.commons.collections4.bloomfilter.Shape; + +/** + * A convenience class for Hasher implementations to filter out duplicate indices. + * + * <p><em>If the index is negative the behavior is not defined.</em></p> + * + * <p>This is conceptually a unique filter implemented as a {@code Predicate<int>}.</p> + * @since 4.5 + */ +public final class Filter implements IntPredicate { + private IndexTracker tracker; + private int size; + private IntPredicate consumer; + + /** + * Creates an instance optimized for the specified shape. + * @param shape The shape that is being generated. + * @param consumer The consumer to accept the values. + * @return a Filter optimized for the shape. Review comment: done. -- 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]
