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

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

Introduction

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

Prototype

public static <E> ImmutableList<E> copyOf(E[] elements) 

Source Link

Usage

From source file:com.isotrol.impe3.api.component.sitemap.Sitemap.java

private static <T> ImmutableList<T> create(Iterable<T> entries) {
    if (entries == null) {
        return ImmutableList.of();
    } else {//from  w  w w  .  jav a 2  s . c  o  m
        return ImmutableList.copyOf(Iterables.filter(entries, Predicates.notNull()));
    }
}

From source file:org.apache.tajo.catalog.FieldConverter.java

public static QualifiedIdentifier toQualifiedIdentifier(String name) {
    final Collection<String> elems = ImmutableList.copyOf(name.split("\\."));
    final Collection<Identifier> identifiers = Collections2.transform(elems,
            new Function<String, Identifier>() {
                @Override//  w  ww.  j a v a  2 s  . c o  m
                public Identifier apply(@Nullable String input) {
                    return Identifier._(input, IdentifierUtil.isShouldBeQuoted(input));
                }
            });
    return QualifiedIdentifier.$(identifiers);
}

From source file:com.google.errorprone.refaster.UTypeApply.java

public static UTypeApply create(UExpression type, List<UExpression> typeArguments) {
    return new AutoValue_UTypeApply(type, ImmutableList.copyOf(typeArguments));
}

From source file:com.opengamma.strata.engine.config.pricing.PricingRules.java

/**
 * Returns a set of pricing rules that delegates to multiple underlying sets of rules, returning the first
 * valid configuration it finds.//from  ww  w.j  a v a2 s.com
 *
 * @param rules  the delegate pricing rules
 * @return a set of market data rules that delegates to multiple underlying sets of rules, returning the first
 *   valid configuration it finds
 */
public static PricingRules of(PricingRules... rules) {
    switch (rules.length) {
    case 0:
        return PricingRules.empty();
    case 1:
        return rules[0];
    default:
        return CompositePricingRules.builder().rules(ImmutableList.copyOf(rules)).build();
    }
}

From source file:com.google.errorprone.refaster.UUnionType.java

static UUnionType create(Iterable<? extends UExpression> typeAlternatives) {
    return new AutoValue_UUnionType(ImmutableList.copyOf(typeAlternatives));
}

From source file:com.cdancy.artifactory.rest.domain.system.Version.java

@SerializedNames({ "version", "revision", "addons", "license" })
public static Version create(String version, String revision, List<String> addons, String license) {
    return new AutoValue_Version(version, revision,
            addons != null ? ImmutableList.copyOf(addons) : ImmutableList.<String>of(), license);
}

From source file:com.cdancy.etcd.rest.domain.auth.User.java

@SerializedNames({ "user", "roles", "errorMessage" })
public static User create(String user, List<String> roles, ErrorMessage errorMessage) {
    return new AutoValue_User(user, roles != null ? ImmutableList.copyOf(roles) : ImmutableList.<String>of(),
            errorMessage);//from  w  w  w.  j  a v  a2 s  .com
}

From source file:com.google.errorprone.refaster.UMethodType.java

public static UMethodType create(UType returnType, List<UType> parameterTypes) {
    return new AutoValue_UMethodType(returnType, ImmutableList.copyOf(parameterTypes));
}

From source file:org.jclouds.util.Modules2.java

public static Iterable<Module> modulesFromCommaDelimitedString(String moduleClasses) {
    Iterable<Module> modules = ImmutableSet.of();
    if (moduleClasses != null) {
        Iterable<String> transformer = ImmutableList.copyOf(on(',').split(moduleClasses));
        modules = transform(transformer, new Function<String, Module>() {

            @Override// www .  jav a 2s . co m
            public Module apply(String from) {
                try {
                    return (Module) Class.forName(from).newInstance();
                } catch (InstantiationException e) {
                    throw new RuntimeException("error instantiating " + from, e);
                } catch (IllegalAccessException e) {
                    throw new RuntimeException("error instantiating " + from, e);
                } catch (ClassNotFoundException e) {
                    throw new RuntimeException("error instantiating " + from, e);
                }
            }

        });
    }
    return modules;
}

From source file:io.prestosql.plugin.jdbc.JdbcQueryRunner.java

public static DistributedQueryRunner createJdbcQueryRunner(TpchTable<?>... tables) throws Exception {
    return createJdbcQueryRunner(ImmutableList.copyOf(tables));
}