/** * Checks if this iterable contains any element matching the provided predicate. * <p> * A <code>null</code> or empty iterable returns false. * * @param predicate the predicate to use, may not be null * @return true if at least one element contained in this iterable matches the predicate, * false otherwise * @throws NullPointerException if predicate is null */ public boolean anyMatch(final Predicate<? super E> predicate) { return IterableUtils.matchesAny(iterable, predicate); }
/** * Answers true if a predicate is true for at least one element of a * collection. * <p> * A <code>null</code> collection or predicate returns false. * * @param <C> the type of object the {@link Iterable} contains * @param input the {@link Iterable} to get the input from, may be null * @param predicate the predicate to use, may be null * @return true if at least one element of the collection matches the predicate * @deprecated since 4.1, use {@link IterableUtils#matchesAny(Iterable, Predicate)} instead */ @Deprecated public static <C> boolean exists(final Iterable<C> input, final Predicate<? super C> predicate) { return predicate != null && IterableUtils.matchesAny(input, predicate); }
/** * Checks if the object is contained in the given iterable. Object equality * is tested with an {@code equator} unlike {@link #contains(Iterable, Object)} * which uses {@link Object#equals(Object)}. * <p> * A <code>null</code> or empty iterable returns false. * A <code>null</code> object will not be passed to the equator, instead a * {@link org.apache.commons.collections4.functors.NullPredicate NullPredicate} * will be used. * * @param <E> the type of object the {@link Iterable} contains * @param iterable the iterable to check, may be null * @param object the object to check * @param equator the equator to use to check, may not be null * @return true if the object is contained in the iterable, false otherwise * @throws NullPointerException if equator is null */ public static <E> boolean contains(final Iterable<? extends E> iterable, final E object, final Equator<? super E> equator) { if (equator == null) { throw new NullPointerException("Equator must not be null."); } return matchesAny(iterable, EqualPredicate.equalPredicate(object, equator)); }
private String getJjdocOutputFileExtension(ProgramArguments arguments) { String outputFileExtension = ".html"; if (IterableUtils.matchesAny(Arrays.asList(arguments.toArray()), outputTextPredicate())) { outputFileExtension = ".txt"; } return outputFileExtension; }
@Override public boolean evaluate(String object) { return IterableUtils.matchesAny(findMacAddresses(object), new StringContains(filter)); } }
@Override public void execute(Pair<WiFiChannel, WiFiChannel> input) { Button button = view.findViewById(ids.get(input)); if (visible.contains(input)) { button.setVisibility(View.VISIBLE); setSelected(button, input.equals(selectedWiFiChannelPair)); setActivity(button, input, IterableUtils.matchesAny(wiFiDetails, new InRangePredicate(input))); } else { button.setVisibility(View.GONE); setSelected(button, false); } }