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

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

Introduction

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

Prototype

public static <E> ImmutableSet<E> copyOf(Iterator<? extends E> elements) 

Source Link

Usage

From source file:com.facebook.buck.core.build.event.BuildEvent.java

public static Started started(Iterable<String> buildArgs) {
    return new Started(ImmutableSet.copyOf(buildArgs));
}

From source file:ca.cutterslade.match.scheduler.Tier.java

static ImmutableSet<Tier> forNames(Set<String> names) {
    return ImmutableSet.copyOf(Collections2.transform(names, new Function<String, Tier>() {

        @Override// w  w w . j a  va  2s  .c  o  m
        public Tier apply(String name) {
            return new Tier(name);
        }
    }));
}

From source file:dagger2.producers.internal.SetProducer.java

/**
 * Returns a new producer that creates {@link Set} futures from the union of the given
 * {@link Producer} instances.//w  w  w  .  j a  v a2s  .  c om
 */
public static <T> Producer<Set<T>> create(@SuppressWarnings("unchecked") Producer<Set<T>>... producers) {
    return new SetProducer<T>(ImmutableSet.copyOf(producers));
}

From source file:com.google.template.soy.jssrc.dsl.Declaration.java

static Declaration create(String varName, CodeChunk.WithValue rhs,
        @Nullable String closureCompilerTypeExpression, Iterable<GoogRequire> googRequires) {
    return new AutoValue_Declaration(varName, rhs, closureCompilerTypeExpression,
            ImmutableSet.copyOf(googRequires));
}

From source file:org.auraframework.impl.util.AuraUtil.java

/**
 * Accepts a Set, or null, and always returns an immutable Set. If set was
 * null, return will be an empty ImmutableSet
 * //www.java 2s  . co  m
 * @param <T> Any Object type
 * @param set any set, or null
 * @return An ImmutableSet that is a copy of set, or an empty ImmutableSet
 *         if set was null
 */
public static <T> Set<T> immutableSet(Set<T> set) {
    if (set == null) {
        return ImmutableSet.of();
    }
    return ImmutableSet.copyOf(set);
}

From source file:com.eviware.loadui.util.ReleasableUtils.java

/**
 * Releases all Releasable objects in the given varargs. For arguments that
 * are a Collection, each of its children will be released.
 * /*w  w  w .j  ava2s.  c  o m*/
 * @param objects
 */
public static void releaseAll(Object... objects) {
    for (Object object : objects) {
        if (object instanceof Iterable && !(object instanceof Releasable)) {
            for (Object child : ImmutableSet.copyOf(Iterables.filter((Iterable<?>) object, Object.class)))
                releaseAll(child);
        }
        release(object);
    }
}

From source file:com.facebook.buck.apple.AppleBundleExtensions.java

public static boolean pathsHaveValidTestExtensions(Path... paths) {
    return allPathsHaveValidTestExtensions(ImmutableSet.copyOf(paths));
}

From source file:io.prestosql.operator.StageExecutionDescriptor.java

public static StageExecutionDescriptor groupedExecution(List<PlanNodeId> capableScanNodes) {
    requireNonNull(capableScanNodes, "capableScanNodes is null");
    checkArgument(!capableScanNodes.isEmpty());
    return new StageExecutionDescriptor(ImmutableSet.copyOf(capableScanNodes));
}

From source file:org.jclouds.vcloud.director.v1_5.domain.dmtf.CIMPredicates.java

/**
 * Return resource allocations of the specific type.
 * /*w  w w  .ja va 2 s.co  m*/
 * @param type
 *           type to match the items
 * @return predicate
 */
public static Predicate<ResourceAllocationSettingData> resourceTypeIn(final ResourceType... types) {
    checkNotNull(types, "resourceTypes");
    final Set<ResourceType> resourceTypes = ImmutableSet.copyOf(types);
    return new Predicate<ResourceAllocationSettingData>() {
        @Override
        public boolean apply(ResourceAllocationSettingData in) {
            return resourceTypes.contains(in.getResourceType());
        }

        @Override
        public String toString() {
            return "resourceTypeIn(" + resourceTypes + ")";
        }
    };
}

From source file:com.facebook.presto.operator.StageExecutionStrategy.java

public static StageExecutionStrategy groupedExecution(List<PlanNodeId> capableScanNodes) {
    requireNonNull(capableScanNodes, "capableScanNodes is null");
    checkArgument(!capableScanNodes.isEmpty());
    return new StageExecutionStrategy(ImmutableSet.copyOf(capableScanNodes));
}