Returns a new Filter that accepts the intersection of the tests accepted
by this Filter and {@code second}
965187
public Filter intersect(final Filter second) {
        if (second == this || second == ALL) {
            return this;
        }
        final Filter first = this;
        return new Filter() {
            @Override
            public boolean shouldRun(Description description) {
                return first.shouldRun(description)
                        && second.shouldRun(description);
            }

            @Override
            public String describe() {
                return first.describe() + " and " + second.describe();
            }
        };
    }
1167580
public static <T extends Case2<A, B>, A, B, EB extends B> DecomposableMatchBuilder0<T> case2(
      Class<T> clazz, MatchesExact<A> a, DecomposableMatchBuilder0<EB> b) {
    List<Matcher<Object>> matchers = Lists.of(ArgumentMatchers.eq(a.t), ArgumentMatchers.any());
    return new DecomposableMatchBuilder1<T, EB>(matchers, 1, new Case2FieldExtractor<>(clazz))
        .decomposeFirst(b);
  }
609574
public <U extends T, A, B> InitialMatching2<T, U, A, B> when(
      DecomposableMatchBuilder2<U, A, B> decomposableMatchBuilder) {
    return new InitialMatching2<>(decomposableMatchBuilder.build(), value);
  }
204220
public static <K, V> Map<K, V> filter(Map<K, V> map, Filter<Entry<K, V>> filter) {
		if(null == map || null == filter) {
			return map;
		}
		
		final Map<K, V> map2 = ObjectUtil.clone(map);
		if (isEmpty(map2)) {
			return map2;
		}

		map2.clear();
		for (Entry<K, V> entry : map.entrySet()) {
			if (filter.accept(entry)) {
				map2.put(entry.getKey(), entry.getValue());
			}
		}
		return map2;
	}
1067480
public IntervalCollection<T> intersect(IntervalCollection<T> other) {

        if (this.isEmpty() || other.isEmpty()) {
            List<ChronoInterval<T>> zero = Collections.emptyList();
            return this.create(zero);
        }

        List<ChronoInterval<T>> list = new ArrayList<>();

        for (ChronoInterval<T> a : this.intervals) {
            for (ChronoInterval<T> b : other.intervals) {
                List<ChronoInterval<T>> candidates = new ArrayList<>(2);
                candidates.add(a);
                candidates.add(b);
                candidates.sort(this.getComparator());
                candidates = this.intersect(candidates);
                if (!candidates.isEmpty()) {
                    list.addAll(candidates);
                }
            }
        }

        list.sort(this.getComparator());
        return this.create(list).withBlocks();

    }
468702
public Bbox intersection(Bbox other) {
		if (!this.intersects(other)) {
			return null;
		} else {
			double minx = other.getX() > this.getX() ? other.getX() : this.getX();
			double maxx = other.getEndPoint().getX() < this.getEndPoint().getX() ? other.getEndPoint().getX() : this
					.getEndPoint().getX();
			double miny = other.getY() > this.getY() ? other.getY() : this.getY();
			double maxy = other.getEndPoint().getY() < this.getEndPoint().getY() ? other.getEndPoint().getY() : this
					.getEndPoint().getY();
			return new Bbox(minx, miny, (maxx - minx), (maxy - miny));
		}
	}
50124
public Range intersection(Range other) {
        if (!intersectsWith(other))
            return null;

        return new Range(Math.max(lower, other.lower), Math.min(upper, other.upper), reversed && other.reversed);
    }
676932
@Benchmark
  public int intersectionAndIter(BitmapsForIntersection state)
  {
    ImmutableBitmap intersection = factory.intersection(Arrays.asList(state.bitmaps));
    return iter(intersection);
  }
667666
public static <E> Set<E> intersection(Set<E> first, Set<E> second) {
        if (first == null || second == null) {
            return EMPTY_SET;
        }

        Set<E> intersection = new HashSet<>();

        for (E e : first) {
            if (second.contains(e)) {
                intersection.add(e);
            }
        }
        return intersection;
    }
118705
function multipleFilterFn () {
  return this.choices.choices
    .filter((choice) => choice.checked)
    .map((choice) => choice.key)
}
451744
def intersection(self, other):
        
        if self.capacity != other.capacity or \
            self.error_rate != other.error_rate:
            raise ValueError("Intersecting filters requires both filters to \
have equal capacity and error rate")
        new_bloom = self.copy()
        new_bloom.bitarray = new_bloom.bitarray & other.bitarray
        return new_bloom
1249879
public Optional<Range<T>> intersect(Tuple2<T, T> other) {
        return Tuple2.intersect(this, other).map(Range::new);
    }
700902
function intersectionMatches(a1, a2) {
        for (var i = 0, len = a1.length; i < len; ++i) {
          if (a1[i] !== a2[i]) {
            return false;
          }
        }
        return true;
      }
55347
@Beta
    public <R, E extends Exception, E2 extends Exception> List<R> filterThenFlatMap(final Try.Predicate<? super T, E> filter,
            final Try.Function<? super T, ? extends Collection<? extends R>, E2> mapper) throws E, E2 {
        N.checkArgNotNull(filter);
        N.checkArgNotNull(mapper);

        final List<R> result = new ArrayList<>();

        Collection<? extends R> c = null;

        for (T e : coll) {
            if (filter.test(e)) {
                c = mapper.apply(e);

                if (N.notNullOrEmpty(c)) {
                    result.addAll(c);
                }
            }
        }

        return result;
    }
121186
public static <T> Predicate<T> or(final Predicate<? super T> first, final Predicate<? super T> second) {        //NOPMD
        return new Predicate<T>() {
            @Override
            public boolean test(final T testValue) {
                return first.test(testValue) || second.test(testValue);
            }
        };
    }
206930
public ClassInfoList intersect(final ClassInfoList... others) {
        // Put the first ClassInfoList that is not being sorted by name at the head of the list,
        // so that its order is preserved in the intersection (#238)
        final ArrayDeque<ClassInfoList> intersectionOrder = new ArrayDeque<>();
        intersectionOrder.add(this);
        boolean foundFirst = false;
        for (final ClassInfoList other : others) {
            if (other.sortByName) {
                intersectionOrder.add(other);
            } else if (!foundFirst) {
                foundFirst = true;
                intersectionOrder.push(other);
            } else {
                intersectionOrder.add(other);
            }
        }
        final ClassInfoList first = intersectionOrder.remove();
        final Set<ClassInfo> reachableClassesIntersection = new LinkedHashSet<>(first);
        while (!intersectionOrder.isEmpty()) {
            reachableClassesIntersection.retainAll(intersectionOrder.remove());
        }
        final Set<ClassInfo> directlyRelatedClassesIntersection = new LinkedHashSet<>(directlyRelatedClasses);
        for (final ClassInfoList other : others) {
            directlyRelatedClassesIntersection.retainAll(other.directlyRelatedClasses);
        }
        return new ClassInfoList(reachableClassesIntersection, directlyRelatedClassesIntersection,
                first.sortByName);
    }
920230
private static <T> List<T> intersect(T[] first, T[] second) {
    List<T> result = new ArrayList<>();
    for (T a : first) {
      for (T b : second) {
        if (a.equals(b)) {
          result.add(b);
          break;
        }
      }
    }
    return result;
  }