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, @Nullable E second, E[] rest) 

Source Link

Document

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

Usage

From source file:de.cosmocode.commons.concurrent.Runnables.java

/**
 * Chains multiple {@link Runnable}s together.
 * /*from w  ww. jav  a  2 s .c  o  m*/
 * @param first the first Runnable
 * @param second the second Runnable
 * @param rest zero or more additional Runnables
 * @return a Runnable which runs all given Runnables in a sequence
 * @throws NullPointerException if first, second or rest is null
 */
public static Runnable chain(Runnable first, Runnable second, Runnable... rest) {
    Preconditions.checkNotNull(first, "First");
    Preconditions.checkNotNull(second, "Second");
    Preconditions.checkNotNull(rest, "Rest");
    return chain(Lists.asList(first, second, rest));
}

From source file:eu.numberfour.n4js.utils.resources.ExternalProjectBuildOrderProvider.java

/**
 * Computes the build order among specified projects given as the argument.
 *
 * @param first/*from   ww w.java  2  s  .  co m*/
 *            the first mandatory project.
 * @param second
 *            the second project.
 * @param rest
 *            the rest of the projects. Can be omitted but must not be {@code null}, or must not contain
 *            {@code null} elements.
 *
 * @return the build order as an array of build configuration instances.
 */
public static IBuildConfiguration[] getBuildOrder(final ExternalProject first, final ExternalProject second,
        final ExternalProject... rest) {

    return getBuildOrder(newHashSet(Lists.asList(first, second, rest)));
}

From source file:org.elasticsearch.common.logging.Loggers.java

/** Just like {@link #getLogger(Class,Settings,ShardId,String...)} but String loggerName instead of Class. */
public static ESLogger getLogger(String loggerName, Settings settings, ShardId shardId, String... prefixes) {
    return getLogger(loggerName, settings, Lists
            .asList(shardId.index().name(), Integer.toString(shardId.id()), prefixes).toArray(new String[0]));
}

From source file:eu.numberfour.n4js.n4mf.utils.ProjectTypePredicate.java

/**
 * Sugar for creating a new predicate that is the logical disjunction of the given predicates.
 *
 * @param first/* w  w w . j  a v a  2s.  c o m*/
 *            the first predicate.
 * @param second
 *            the second predicate.
 * @param others
 *            the rest of the predicates. Optional, can be omitted, but when given must not contain {@code null}.
 * @return a logical disjunction of the predicates.
 */
public static ProjectTypePredicate or(ProjectTypePredicate first, ProjectTypePredicate second,
        ProjectTypePredicate... others) {

    return new ProjectTypePredicate(Predicates.or(Lists.asList(first, second, others)));
}

From source file:org.elasticsearch.common.logging.Loggers.java

public static ESLogger getLogger(Class clazz, Settings settings, Index index, String... prefixes) {
    return getLogger(clazz, settings, Lists.asList(SPACE, index.name(), prefixes).toArray(new String[0]));
}

From source file:org.eclipse.viatra.query.runtime.localsearch.operations.check.InequalityCheck.java

@Override
public List<Integer> getVariablePositions() {
    return Lists.asList(sourceLocation, targetLocation, new Integer[0]);
}

From source file:org.polymap.model2.query.Expressions.java

public static Conjunction and(BooleanExpression first, BooleanExpression second, BooleanExpression... more) {
    return new Conjunction(Lists.asList(first, second, more).toArray(new BooleanExpression[2 + more.length]));
}

From source file:org.polymap.model2.query.Expressions.java

public static Disjunction or(BooleanExpression first, BooleanExpression second, BooleanExpression... more) {
    return new Disjunction(Lists.asList(first, second, more).toArray(new BooleanExpression[2 + more.length]));
}

From source file:org.eclipse.incquery.runtime.localsearch.operations.check.ContainmentCheck.java

@Override
public List<Integer> getVariablePositions() {
    return Lists.asList(childPosition, containerPosition, new Integer[0]);
}

From source file:com.axelor.rpc.filter.Filter.java

public static Filter in(String fieldName, Object first, Object second, Object... rest) {
    return in(fieldName, Lists.asList(first, second, rest));
}