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:org.glowroot.agent.weaving.ClassNames.java

static ImmutableList<String> fromInternalNames(List<String> internalNames) {
    if (internalNames.isEmpty()) {
        // optimization for a common case
        return ImmutableList.of();
    }//from  w ww  . j a va2  s  .  c  o m
    List<String> classNames = Lists.newArrayList();
    for (String internalName : internalNames) {
        classNames.add(internalName.replace('/', '.'));
    }
    return ImmutableList.copyOf(classNames);
}

From source file:org.jclouds.chef.util.CollectionUtils.java

/**
 * Creates an immutable list with the elements of the given list. If the
 * input list is <code>null</code>, it returns an empty list.
 * /*from w w w. j a  v a  2 s  .c  o  m*/
 * @param input
 *           The list used to build the immutable one.
 * @return An immutable list with the elements of the given list.
 */
public static <T> ImmutableList<T> copyOfOrEmpty(@Nullable List<T> input) {
    return input == null ? ImmutableList.<T>of() : ImmutableList.copyOf(input);
}

From source file:net.sourceforge.cilib.util.Sequence.java

public static Sequence copyOf(Iterable<Number> iterable) {
    return new Sequence(ImmutableList.copyOf(iterable));
}

From source file:org.jclouds.azurecompute.arm.domain.Metric.java

@SerializedNames({ "data", "id", "name", "type", "unit" })
public static Metric create(final List<MetricData> data, final String id, final MetricName name,
        final String type, final String unit) {
    return new AutoValue_Metric(data == null ? ImmutableList.<MetricData>of() : ImmutableList.copyOf(data), id,
            name, type, unit);/*from w w w  . j av  a  2s .  co m*/
}

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

public static UTypeApply create(UExpression type, UExpression... typeArguments) {
    return create(type, ImmutableList.copyOf(typeArguments));
}

From source file:com.cdancy.artifactory.rest.domain.storage.StorageInfo.java

@SerializedNames({ "binariesSummary", "fileStoreSummary", "repositoriesSummaryList" })
public static StorageInfo create(BinariesSummary binariesSummary, FileStoreSummary fileStoreSummary,
        List<RepositorySummary> repositoriesSummaryList) {
    return new AutoValue_StorageInfo(binariesSummary, fileStoreSummary,
            repositoriesSummaryList != null ? ImmutableList.copyOf(repositoriesSummaryList)
                    : ImmutableList.<RepositorySummary>of());
}

From source file:extrabiomes.helpers.ForestryModHelper.java

public static Collection<ItemStack> getSaplings() {
    return ImmutableList.copyOf(saplings);
}

From source file:org.jclouds.docker.internal.NullSafeCopies.java

public static <E> List<E> copyOf(@Nullable E[] array) {
    return array != null ? ImmutableList.copyOf(array) : ImmutableList.<E>of();
}

From source file:com.pingcap.tikv.TiConfiguration.java

public static TiConfiguration createDefault(List<String> pdAddrs) {
    TiConfiguration conf = new TiConfiguration();
    conf.pdAddrs = ImmutableList.copyOf(Iterables.transform(ImmutableSet.copyOf(pdAddrs).asList(),
            addStr -> HostAndPort.fromString(addStr)));
    return conf;//w  ww  .  ja  va  2  s .  c o m
}

From source file:ro.cosu.vampires.server.actors.messages.workload.DeleteWorkload.java

public static DeleteWorkload create(List<String> configurations, User user) {
    return new AutoValue_DeleteWorkload(ImmutableList.copyOf(configurations), user);
}