Example usage for com.google.common.collect Iterables any

List of usage examples for com.google.common.collect Iterables any

Introduction

In this page you can find the example usage for com.google.common.collect Iterables any.

Prototype

public static <T> boolean any(Iterable<T> iterable, Predicate<? super T> predicate) 

Source Link

Document

Returns true if any element in iterable satisfies the predicate.

Usage

From source file:io.druid.java.util.common.JodaUtils.java

public static boolean overlaps(final Interval i, Iterable<Interval> intervals) {
    return Iterables.any(intervals, new Predicate<Interval>() {
        @Override//from  w w  w  . j a  va2s  .c om
        public boolean apply(Interval input) {
            return input.overlaps(i);
        }
    });

}

From source file:com.clarkparsia.pelletserver.client.services.PSDiscovery.java

public PSDiscovery(PelletServer server, Endpoint endpoint, MimeType... mimetypes) {
    super(server, endpoint, mimetypes);

    checkArgument(Iterables.any(this.mimetypes, PelletServerMimeTypes.getPredicate(MIMETYPE)),
            getName() + " service must support %s", MIMETYPE);
}

From source file:com.clarkparsia.pelletserver.client.services.Consistency.java

public Consistency(KnowledgeBase kb, Endpoint endpoint, MimeType... mimetypes) {
    super(kb, endpoint, mimetypes);

    checkArgument(Iterables.any(this.mimetypes, PelletServerMimeTypes.getPredicate(MIMETYPE)),
            getName() + " service must support %s", MIMETYPE);
}

From source file:sg.atom.utils._commons.time.JodaUtils.java

public static boolean overlaps(final Interval i, Iterable<Interval> intervals) {
    return Iterables.any(intervals, new Predicate<Interval>() {
        @Override/*  w  w w  . j a  v  a2 s  . com*/
        public boolean apply(@Nullable Interval input) {
            return input.overlaps(i);
        }
    });

}

From source file:com.clarkparsia.pelletserver.client.services.KBDiscovery.java

public KBDiscovery(KnowledgeBase kb, Endpoint endpoint, MimeType... mimetypes) {
    super(kb, endpoint, mimetypes);

    checkArgument(Iterables.any(this.mimetypes, PelletServerMimeTypes.getPredicate(MIMETYPE)),
            getName() + " service must support %s", MIMETYPE);
}

From source file:forge.game.card.CardPredicates.java

public static final Predicate<Card> containsKeyword(final String keyword) {
    return new Predicate<Card>() {
        @Override//from  w ww. j av a  2s .  c  o m
        public boolean apply(final Card c) {
            return Iterables.any(c.getKeywords(), PredicateString.contains(keyword));
        }
    };
}

From source file:nextmethod.web.razor.tokenizer.symbols.SymbolBase.java

@SafeVarargs
public final boolean isTypeOr(@Nonnull final TType... testTypes) {
    return Iterables.any(Arrays.asList(testTypes), input -> input != null && getType() == input);
}

From source file:org.netbeans.modules.android.project.configs.ConfigGroup.java

public void addConfig(Config cfg) {
    if (Iterables.any(configs, hasSimilarName(cfg.getDisplayName()))) {
        throw new IllegalArgumentException("Cannot add config with this name");
    }/*  w  w w . j  a  va 2s .co m*/

    configs.add(cfg);
}

From source file:com.marvelution.bamboo.plugins.sonar.tasks.web.conditions.SonarResultWebItemCondition.java

/**
 * {@inheritDoc}/*from  w w  w. ja v  a2s.  c o  m*/
 */
@Override
public boolean shouldDisplay(Map<String, Object> context) {
    String key = StringUtils.defaultString((String) context.get("planKey"), (String) context.get("buildKey"));
    if (StringUtils.isNotBlank(key)) {
        for (Job job : getAllJobsByKey(key)) {
            if (Iterables.any(job.getBuildDefinition().getTaskDefinitions(), SonarPredicates.isSonarTask())) {
                return true;
            }
        }
    }
    return false;
}

From source file:springfox.documentation.spring.web.plugins.ApiSelectorBuilder.java

private Predicate<RequestHandler> transform(final Predicate<String> pathSelector) {
    return new Predicate<RequestHandler>() {
        @Override/*from w  w w .  java 2 s .c  o m*/
        public boolean apply(RequestHandler input) {
            return Iterables.any(input.getPatternsCondition().getPatterns(), pathSelector);
        }
    };
}