Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.jboss.weld.metadata;
 
 
 
 public class ScanningPredicate<T> implements Predicate<T> {
 
     private final Collection<Predicate<T>> includes;
    private final Collection<Predicate<T>> excludes;
    public ScanningPredicate(Collection<Predicate<T>> includesCollection<Predicate<T>> excludes) {
        this. = includes;
        this. = excludes;
    }
    public boolean apply(T input) {
        // Initial state - all classes are included if no includes are specified
        boolean apply = .isEmpty();
        for (Predicate<T> include : ) {
            // If any include matches, we should include the class
            if (include.apply(input)) {
                apply = true;
            }
        }
        for (Predicate<T> exclude : ) {
            // If any exclude matches, we exclude the class - we can then short-circuit
            if (exclude.apply(input)) {
                return false;
            }
        }
        return apply;
    }
New to GrepCode? Check out our FAQ X