MCPcopy Create free account
hub / github.com/Card-Forge/forge / or

Method or

forge-core/src/main/java/forge/util/IterableUtil.java:31–35  ·  view source on GitHub ↗

Merges a collection of predicates into a single predicate, which requires the subject to match at least one of the component predicates.

(Iterable<? extends Predicate<? super T>> components)

Source from the content-addressed store, hash-verified

29 * which requires the subject to match at least one of the component predicates.
30 */
31 public static <T> Predicate<T> or(Iterable<? extends Predicate<? super T>> components) {
32 if(components instanceof List && ((List<?>) components).size() == 1)
33 return ((List<? extends Predicate<? super T>>) components).get(0)::test;
34 return x -> any(components, i -> i.test(x));
35 }
36
37 public static <T> Iterable<T> filter(Iterable<T> iterable, Predicate<? super T> filter) {
38 return () -> StreamSupport.stream(iterable.spliterator(), false).filter(filter).iterator();

Callers 15

buildFilterMethod · 0.95
buildPredicateMethod · 0.95
buildFormatFilterMethod · 0.95
buildPredicateMethod · 0.95
buildPredicateMethod · 0.95
ItemPredicateClass · 0.80
PaperCardPredicatesClass · 0.80
CardRulesPredicatesClass · 0.80
getCardsForFilterMethod · 0.80
sanisfySubtypesMethod · 0.80

Calls 4

anyMethod · 0.95
sizeMethod · 0.65
getMethod · 0.65
testMethod · 0.45

Tested by

no test coverage detected