List of usage examples for com.google.common.collect Iterables any
public static <T> boolean any(Iterable<T> iterable, Predicate<? super T> predicate)
From source file:com.twitter.aurora.scheduler.filter.AttributeFilter.java
/** * Tests whether a constraint is satisfied by attributes. * * @param attributes Host attributes./*from ww w . j av a 2s . c o m*/ * @param constraint Constraint to match. * @return {@code true} if the attribute satisfies the constraint, {@code false} otherwise. */ static boolean matches(Set<Attribute> attributes, IValueConstraint constraint) { Set<String> allAttributes = ImmutableSet .copyOf(Iterables.concat(Iterables.transform(attributes, GET_VALUES))); boolean match = Iterables.any(constraint.getValues(), Predicates.in(allAttributes)); return constraint.isNegated() ^ match; }
From source file:com.google.cloud.genomics.dataflow.functions.SharedMinorAllelesCalculator.java
private boolean hasMinorAllele(Call call) { return Iterables.any(call.getGenotype(), new Predicate<Integer>() { @Override//w w w .j ava 2 s . c o m public boolean apply(Integer genotype) { if (isReferenceMajor) { return genotype > 0; } else { return genotype == 0; } } }); }
From source file:com.google.cloud.genomics.dataflow.functions.ibs.SharedMinorAllelesCalculator.java
private boolean hasMinorAllele(VariantCall call) { return Iterables.any(call.getGenotypeList(), new Predicate<Integer>() { @Override/*from w w w .ja v a 2 s . com*/ public boolean apply(Integer genotype) { if (isReferenceMajor) { return genotype > 0; } else { return genotype == 0; } } }); }
From source file:pl.nort.dayoneevernote.filter.LabelMatchPredicate.java
@Override public boolean apply(Note note) { return Iterables.any(note.getLabels(), new Predicate<String>() { @Override//from w w w . j a v a 2 s. c om public boolean apply(String input) { return input.matches(pattern); } }); }
From source file:com.mycila.testing.plugins.jetty.locator.FallbackFileLocator.java
public Iterable<File> locate(final String path) throws FileNotFoundException { Iterable<File> files = this.locator.locate(path); final boolean useFallback = Iterables.any(files, not(new ExistsFilePredicate())); if (useFallback) { files = this.fallbackLocator.locate(path); }/* w w w .jav a 2 s .c o m*/ return files; }
From source file:com.netflix.simianarmy.client.aws.chaos.TagPredicate.java
@Override public boolean apply(ChaosCrawler.InstanceGroup instanceGroup) { return Iterables.any(instanceGroup.tags(), new com.google.common.base.Predicate<TagDescription>() { @Override//from w ww .j a va 2 s . c o m public boolean apply(TagDescription tagDescription) { return tagDescription.getKey().equals(key) && tagDescription.getValue().equals(value); } }); }
From source file:org.apache.hadoop.hive.metastore.datasource.DataSourceProviderFactory.java
/** * @param hdpConfig hadoop configuration * @return true if the configuration contains settings specifically aimed for one * of the supported conntection pool implementations. *//* w ww . j a v a2 s .c o m*/ public static boolean hasProviderSpecificConfigurations(Configuration hdpConfig) { String poolingType = MetastoreConf.getVar(hdpConfig, MetastoreConf.ConfVars.CONNECTION_POOLING_TYPE) .toLowerCase(); return Iterables.any(hdpConfig, entry -> { String key = entry.getKey(); return key != null && (key.startsWith(poolingType)); }); }
From source file:org.asoem.greyfish.utils.collect.AbstractFunctionalList.java
@Override public boolean any(final Predicate<E> predicate) { return Iterables.any(this, predicate); }
From source file:uk.ac.stfc.isis.ibex.configserver.internal.IocNameFilterPredicate.java
@Override public boolean apply(Collection<EditableIoc> toFilter, EditableIoc item) { final String iocName = normalise(item.getName()); return Iterables.any(normaliseEach(toFilter), new Predicate<String>() { @Override//from w w w .j av a2s . com public boolean apply(String forbidden) { return iocName.startsWith(forbidden); } }); }
From source file:see.properties.impl.MethodResolver.java
@Override public boolean canGet(@Nullable Object target, @Nonnull PropertyAccess propertyAccess) { if (target == null || !propertyAccess.value().hasLeft()) return false; final String methodName = propertyAccess.value().leftValue(); return Iterables.any(asList(target.getClass().getMethods()), new Predicate<Method>() { @Override/* w w w. ja v a 2 s.co m*/ public boolean apply(Method input) { return methodName.equals(input.getName()); } }); }