Example usage for com.google.common.collect Lists asList

List of usage examples for com.google.common.collect Lists asList

Introduction

In this page you can find the example usage for com.google.common.collect Lists asList.

Prototype

public static <E> List<E> asList(@Nullable E first, E[] rest) 

Source Link

Document

Returns an unmodifiable list containing the specified first element and backed by the specified array of additional elements.

Usage

From source file:com.b2international.snowowl.snomed.importer.rf2.model.IndexConfiguration.java

public IndexConfiguration(final String indexName, final String tableName, final String firstColumnName,
        final String... restColumnNames) {
    this.indexName = indexName;
    this.tableName = tableName;
    this.columnNames = Lists.asList(firstColumnName, restColumnNames);
}

From source file:org.apache.brooklyn.util.http.HttpAsserts.java

public static void assertContentNotContainsText(final String url, final String phrase,
        final String... additionalPhrases) {
    try {/*  w  ww . ja v  a 2 s  . co  m*/
        String contents = HttpTool.getContent(url);
        Asserts.assertTrue(contents != null);
        for (String text : Lists.asList(phrase, additionalPhrases)) {
            if (contents.contains(text)) {
                LOG.warn("CONTENTS OF URL " + url + " HAS TEXT: " + text + "\n" + contents);
                Asserts.fail("URL " + url + " contain text: " + text);
            }
        }
    } catch (Exception e) {
        throw propagateAsAssertionError(e);
    }
}

From source file:com.google.devtools.kythe.platform.java.helpers.JCTreeScanner.java

public R scanAll(P p, JCTree tree, JCTree... others) {
    return scan(Lists.asList(tree, others), p);
}

From source file:brooklyn.test.HttpTestUtils.java

public static void assertContentContainsText(final String url, final String phrase,
        final String... additionalPhrases) {
    try {//w w w.j av  a 2 s . c o  m
        String contents = getContent(url);
        Assert.assertTrue(contents != null && contents.length() > 0);
        for (String text : Lists.asList(phrase, additionalPhrases)) {
            if (!contents.contains(text)) {
                LOG.warn("CONTENTS OF URL " + url + " MISSING TEXT: " + text + "\n" + contents);
                Assert.fail("URL " + url + " does not contain text: " + text);
            }
        }
    } catch (Exception e) {
        throw Throwables.propagate(e);
    }
}

From source file:org.sonar.sslr.grammar.GrammarBuilder.java

/**
 * Creates parsing expression - "zero or more".
 * Convenience method equivalent to calling {@code zeroOrMore(sequence(e1, rest))}.
 *
 * @param e1  sub-expression// w  w  w .j  ava  2  s.co  m
 * @param rest  rest of sub-expressions
 * @throws IllegalArgumentException if any of given arguments is not a parsing expression
 * @see #zeroOrMore(Object)
 * @see #sequence(Object, Object)
 */
public final Object zeroOrMore(Object e1, Object... rest) {
    return new ZeroOrMoreExpression(new SequenceExpression(convertToExpressions(Lists.asList(e1, rest))));
}

From source file:com.eucalyptus.ws.protocol.BaseQueryBinding.java

private String extractOperationName(final MappingHttpRequest httpRequest) {
    if (httpRequest.getParameters().containsKey(this.operationParam.toString())) {
        return httpRequest.getParameters().get(this.operationParam.toString());
    } else {/*from   www . j a  v  a2  s .  co  m*/
        for (final T param : this.altOperationParams) {
            if (httpRequest.getParameters().containsKey(param.toString())) {
                return httpRequest.getParameters().get(param.toString());
            }
        }
    }
    LOG.error("Failed to find operation parameter an "
            + Lists.asList(this.operationParam, this.altOperationParams.toArray()).toString()
            + " in HTTP request: " + httpRequest);
    return null;
}

From source file:mx.bigdata.sat.cfdi.CFDv3.java

private static JAXBContext getContext(String[] contexts) throws Exception {
    List<String> ctx = Lists.asList(BASE_CONTEXT, contexts);
    return JAXBContext.newInstance(JOINER.join(ctx));
}

From source file:org.apache.brooklyn.util.http.HttpAsserts.java

public static void assertErrorContentContainsText(final String url, final String phrase,
        final String... additionalPhrases) {
    try {/*from   w ww  .  j  a va  2s. c o  m*/
        String contents = HttpTool.getErrorContent(url);
        Asserts.assertTrue(contents != null && contents.length() > 0);
        for (String text : Lists.asList(phrase, additionalPhrases)) {
            if (!contents.contains(text)) {
                LOG.warn("CONTENTS OF URL " + url + " MISSING TEXT: " + text + "\n" + contents);
                Asserts.fail("URL " + url + " does not contain text: " + text);
            }
        }
    } catch (Exception e) {
        throw propagateAsAssertionError(e);
    }
}

From source file:org.apache.calcite.plan.RelOptRule.java

/**
 * Creates a list of child operands that matches child relational
 * expressions in the order they appear.
 *
 * @param first First child operand//from  w w  w . j  av a2s  .co  m
 * @param rest  Remaining child operands (may be empty)
 * @return List of child operands that matches child relational
 *   expressions in the order
 */
public static RelOptRuleOperandChildren some(RelOptRuleOperand first, RelOptRuleOperand... rest) {
    return new RelOptRuleOperandChildren(RelOptRuleOperandChildPolicy.SOME, Lists.asList(first, rest));
}

From source file:org.apache.streams.facebook.serializer.FacebookActivityUtil.java

/**
 * Formats the ID to conform with the Apache Streams activity ID convention
 * @param idparts the parts of the ID to join
 * @return a valid Activity ID in format "id:facebook:part1:part2:...partN"
 *///w w  w  .  j  a va 2 s.c  o  m
public static String formatId(String... idparts) {
    return Joiner.on(":").join(Lists.asList("id:facebook", idparts));
}