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:de.cosmocode.commons.reflect.HierarchyTreeNode.java

@Override
public Collection<TreeNode<Class<?>>> getChildren() {
    final List<Class<?>> types;

    if (type.getSuperclass() == null) {
        types = Arrays.asList(type.getInterfaces());
    } else {/*from  w  w  w .  ja  v  a  2 s . com*/
        types = Lists.asList(type.getSuperclass(), type.getInterfaces());
    }

    return Collections2.transform(types, new Function<Class<?>, TreeNode<Class<?>>>() {

        @Override
        public TreeNode<Class<?>> apply(Class<?> from) {
            return new HierarchyTreeNode(from, HierarchyTreeNode.this, root);
        }

    });
}

From source file:com.palantir.common.base.BatchingVisitableView.java

public BatchingVisitableView<T> concat(BatchingVisitable<? extends T>... inputs) {
    return BatchingVisitables.concat(Lists.asList(delegate(), inputs));
}

From source file:com.palantir.giraffe.file.UniformPath.java

/**
 * Converts a path string, or a sequence of strings that form a path string
 * when joined, to a {@code UniformPath}.
 *
 * @param first the path string or initial part of the path string
 * @param more additional strings to join to form the path string
 *//* w ww .  j av  a  2s .c  o m*/
public static UniformPath get(String first, String... more) {
    return get(Lists.asList(first, more));
}

From source file:org.jboss.hal.core.mbui.form.OperationFormBuilder.java

public OperationFormBuilder<T> exclude(@NonNls String first, @NonNls String... rest) {
    excludes.addAll(Lists.asList(first, rest));
    return this;
}

From source file:com.opengamma.strata.market.curve.definition.CurveGroupDefinitionBuilder.java

/**
 * Adds the definition of a discount curve to the curve group definition.
 *
 * @param curveDefinition  the discount curve configuration
 * @param otherCurrencies  additional currencies for which the curve can provide discount factors
 * @param currency  the currency for which the curve provides discount rates
 * @return this builder// w  ww .jav a  2 s  .  com
 */
public CurveGroupDefinitionBuilder addDiscountCurve(NodalCurveDefinition curveDefinition, Currency currency,
        Currency... otherCurrencies) {

    ArgChecker.notNull(curveDefinition, "curveDefinition");
    ArgChecker.notNull(currency, "currency");
    CurveGroupEntry entry = CurveGroupEntry.builder().curveDefinition(curveDefinition)
            .discountCurrencies(ImmutableSet.copyOf(Lists.asList(currency, otherCurrencies))).build();
    entries.add(entry);
    return this;
}

From source file:bear.task.TaskResult.java

public TaskResult<?> and(TaskResult<?>... results) {
    return Tasks.and(Lists.asList(this, results));
}

From source file:edu.mit.streamjit.impl.common.SerialCompositeStreamVisitor.java

public SerialCompositeStreamVisitor(StreamVisitor firstVisitor, StreamVisitor... moreVisitors) {
    this(ImmutableSet.copyOf(Lists.asList(firstVisitor, moreVisitors)));
}

From source file:com.b2international.snowowl.datastore.request.Locks.java

public Locks(RepositoryContext context, String userId, String description, String parentLockContext,
        Branch firstBranch, Branch... nextBranches) throws OperationLockException, InterruptedException {
    repositoryId = context.id();//from   ww  w.  j  a v a 2  s .c o  m
    lockManager = context.service(IDatastoreOperationLockManager.class);
    lockContext = new DatastoreLockContext(userId, description,
            Strings.isNullOrEmpty(parentLockContext) ? ROOT : parentLockContext);

    lockTargets = Maps.newHashMap();
    for (Branch branch : Lists.asList(firstBranch, nextBranches)) {
        lockTargets.put(branch.path(),
                new SingleRepositoryAndBranchLockTarget(repositoryId, branch.branchPath()));
    }

    lock();
}

From source file:com.vsct.dt.hesperides.EventStoreMock.java

public void loadEvents() {
    final int SIZE = 300;
    Event[] list = new Event[SIZE];

    for (int i = 0; i < SIZE - 1; i++) {
        Event e = new Event("com.vsct.dt.hesperides.applications.PropertiesSavedEvent",
                "{\"applicationName\":\"KTN\",\"platformName\":\"USN1\",\"path\":\"#DEMO#WAS#demoKatana-war#1.0.0.0#WORKINGCOPY\",\"properties\":{\"key_value_properties\":[{\"name\":\"expression_reguliere\",\"value\":\"qdfsdfsdfsdfsfsdfs\"},{\"name\":\"propriete_a_surcharger\",\"value\":\"sdfsdfsdf\"},{\"name\":\"username\",\"value\":\"sdfsdfsdf\"},{\"name\":\"test\",\"value\":\"sdfsdfsdfsdfsdfs\"}],\"iterable_properties\":[]}}",
                Long.parseLong("1458896478470"), "untracked"

        );/* w  ww.  ja  v a2s .c  om*/
        list[i] = e;
    }
    this.llist = Lists.asList(list[0], list);
}

From source file:edu.mit.streamjit.util.CollectionUtils.java

/**
 * Returns the union of the given maps, using the given function to merge
 * values for the same key.  The function is called for all keys with a list
 * of the values of the maps in the order the maps were given.  Maps that do
 * not contain the key are not represented in the list.  The function's
 * return value is used as the value in the union map.
 * @param <K> the key type of the returned map
 * @param <V> the value type of the returned map
 * @param <X> the value type of the input map(s)
 * @param merger the function used to merge values for the same key
 * @param first the first map// w ww  . j  ava2 s .co m
 * @param more more maps
 * @return a map containing all the keys in the given maps
 */
@SafeVarargs
public static <K, V, X> ImmutableMap<K, V> union(
        Maps.EntryTransformer<? super K, ? super List<? super X>, ? extends V> merger,
        Map<? extends K, ? extends X> first, Map<? extends K, ? extends X>... more) {
    return union(merger, Lists.asList(first, more));
}