Example usage for com.google.common.collect ImmutableList contains

List of usage examples for com.google.common.collect ImmutableList contains

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableList contains.

Prototype

boolean contains(Object o);

Source Link

Document

Returns true if this list contains the specified element.

Usage

From source file:org.pircbotx.cap.SASLCapHandler.java

public boolean handleLS(PircBotX bot, ImmutableList<String> capabilities) throws CAPException {
    if (capabilities.contains("sasl"))
        //Server supports sasl, send request to use it
        bot.sendCAP().request("sasl");
    else//  w  ww .  j a  v  a 2 s  .  com
        throw new CAPException(CAPException.Reason.UnsupportedCapability, "SASL");
    return false;
}

From source file:com.techcavern.pircbotz.cap.SASLCapHandler.java

public boolean handleLS(PircBotZ bot, ImmutableList<String> capabilities) throws CAPException {
    if (capabilities.contains("sasl"))
        //Server supports sasl, send request to use it
        bot.sendCAP().request("sasl");
    else/*from  www  .j a  v a  2  s .c o  m*/
        throw new CAPException(CAPException.Reason.UnsupportedCapability, "SASL");
    return false;
}

From source file:org.pircbotx.cap.SASLCapHandler.java

public boolean handleNAK(PircBotX bot, ImmutableList<String> capabilities) throws CAPException {
    if (!ignoreFail && capabilities.contains("sasl")) {
        //Make sure the bot didn't register this capability
        bot.getEnabledCapabilities().remove("sasl");
        throw new CAPException(CAPException.Reason.UnsupportedCapability, "SASL");
    }/*  w  ww .j  a  v  a2 s  . c o m*/
    return false;
}

From source file:com.techcavern.pircbotz.cap.SASLCapHandler.java

public boolean handleNAK(PircBotZ bot, ImmutableList<String> capabilities) throws CAPException {
    if (!ignoreFail && capabilities.contains("sasl")) {
        //Make sure the bot didn't register this capability
        bot.getEnabledCapabilities().remove("sasl");
        throw new CAPException(CAPException.Reason.UnsupportedCapability, "SASL");
    }/*from w  w  w .  ja v  a  2 s  . c om*/
    return false;
}

From source file:org.pircbotx.cap.EnableCapHandler.java

public boolean handleACK(PircBotX bot, ImmutableList<String> capabilities) throws CAPException {
    //Finished if the server is acknowledging the capability
    return capabilities.contains(cap);
}

From source file:com.techcavern.pircbotz.cap.EnableCapHandler.java

public boolean handleACK(PircBotZ bot, ImmutableList<String> capabilities) throws CAPException {
    //Finished if the server is acknowledging the capability
    return capabilities.contains(cap);
}

From source file:com.google.devtools.common.options.ParsedOptionDescription.java

public boolean isHidden() {
    ImmutableList<OptionMetadataTag> tags = metadataTags();
    return tags.contains(OptionMetadataTag.HIDDEN) || tags.contains(OptionMetadataTag.INTERNAL);
}

From source file:org.apache.calcite.rel.metadata.ChainedRelMetadataProvider.java

/**
 * Creates a chain.//ww  w . ja  v a  2s .  c  om
 */
protected ChainedRelMetadataProvider(ImmutableList<RelMetadataProvider> providers) {
    this.providers = providers;
    assert !providers.contains(this);
}

From source file:com.spectralogic.ds3autogen.python.generators.response.HeadResponseGenerator.java

/**
 * Gets all response codes/* w  ww. ja v  a 2s  .  c  om*/
 */
@Override
public ImmutableList<Integer> getStatusCodes(final ImmutableList<Ds3ResponseCode> ds3ResponseCodes,
        final String requestName) {
    if (isEmpty(ds3ResponseCodes)) {
        throw new IllegalArgumentException(requestName + " must have response codes 200, and 404");
    }
    final ImmutableList<Integer> codes = ds3ResponseCodes.stream().map(Ds3ResponseCode::getCode)
            .collect(GuavaCollectors.immutableList());

    if (!codes.contains(200) || !codes.contains(404)) {
        throw new IllegalArgumentException(
                requestName + " should contain the response codes 200, and 404. Actual: " + codes);
    }

    if (codes.contains(403)) {
        return codes;
    }

    //If 403 is not in expected codes, add it, and sort the list
    final ImmutableList.Builder<Integer> builder = ImmutableList.builder();
    builder.addAll(codes).add(403);
    return builder.build().stream().sorted().collect(GuavaCollectors.immutableList());
}

From source file:com.google.protoeditor.parsing.AbstractProtoParser.java

public void parseUpTo(PsiBuilder builder, ImmutableList<IElementType> expectedTokens) {
    while (!builder.eof() && !expectedTokens.contains(builder.getTokenType())) {
        builder.advanceLexer();/* ww w  .j a va  2  s  .  co  m*/
    }
}