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:de.metas.ui.web.window.datatypes.DocumentIdsSelection.java

public static DocumentIdsSelection of(final Collection<DocumentId> documentIds) {
    if (documentIds == null || documentIds.isEmpty()) {
        return EMPTY;
    }/*  w  w  w . j  av a 2  s  . c o m*/

    return new DocumentIdsSelection(false, ImmutableSet.copyOf(documentIds));
}

From source file:buildcraft.api.recipes.AssemblyRecipeBasic.java

public AssemblyRecipeBasic(ResourceLocation name, long requiredMicroJoules,
        ImmutableSet<IngredientStack> requiredStacks, @Nonnull ItemStack output) {
    this.requiredMicroJoules = requiredMicroJoules;
    this.requiredStacks = ImmutableSet.copyOf(requiredStacks);
    this.output = ImmutableSet.of(output);
    setRegistryName(name);/*from w  ww  . j a v a 2 s  .  c o m*/
}

From source file:com.facebook.presto.raptor.metadata.BucketShards.java

public BucketShards(OptionalInt bucketNumber, Set<ShardNodes> shards) {
    this.bucketNumber = requireNonNull(bucketNumber, "bucketNumber is null");
    this.shards = ImmutableSet.copyOf(requireNonNull(shards, "shards is null"));
}

From source file:com.google.devtools.build.lib.buildeventstream.AnnounceBuildEventTransportsEvent.java

public AnnounceBuildEventTransportsEvent(Collection<BuildEventTransport> transports) {
    this.transports = ImmutableSet.copyOf(transports);
}

From source file:org.sleuthkit.autopsy.imagegallery.actions.TagGroupAction.java

public TagGroupAction(final TagName tagName, ImageGalleryController controller) {
    super(controller, tagName, null);
    setEventHandler(actionEvent -> new AddTagAction(controller, tagName,
            ImmutableSet.copyOf(controller.viewState().get().getGroup().getFileIDs())).handle(actionEvent));
}

From source file:org.bitbucket.es4gwt.shared.elastic.filter.BooleanOperator.java

BooleanOperator(Collection<ElasticFilter> filters) {
    checkNotNull(filters);
    checkArgument(!filters.isEmpty(), "Empty collection");
    this.filters = ImmutableSet.copyOf(filters);
}

From source file:org.eclipse.xtext.conversion.impl.IgnoreCaseIDValueConverter.java

@Override
protected Set<String> computeValuesToEscape(Grammar grammar) {
    Set<String> result = Sets.newHashSet();
    for (String keyword : GrammarUtil.getAllKeywords(grammar))
        result.add(keyword.toLowerCase());
    return ImmutableSet.copyOf(result);
}

From source file:com.opengamma.engine.marketdata.availability.ValueNameMarketDataAvailabilityFilter.java

/**
 * Creates a provider./*  ww  w  .ja  v a 2s.  c  om*/
 * 
 * @param validMarketDataRequirementNames the valid market data requirement names, not null
 */
public ValueNameMarketDataAvailabilityFilter(final Collection<String> validMarketDataRequirementNames) {
    _validMarketDataRequirementNames = ImmutableSet.copyOf(validMarketDataRequirementNames);
}

From source file:ninja.leaping.permissionsex.command.OptionCommands.java

public static CommandSpec getOptionCommand(PermissionsEx pex) {
    return CommandSpec.builder().setAliases("options", "option", "opt", "o")
            .setArguments(seq(string(t("key")), optional(string(t("value")))))
            .setExecutor(new PermissionsExExecutor(pex) {
                @Override//  w w w.  ja  v a2  s.co  m
                public <TextType> void execute(Commander<TextType> src, CommandContext args)
                        throws CommandException {
                    Map.Entry<String, String> subject = subjectOrSelf(src, args);
                    checkSubjectPermission(src, subject, "permissionsex.option.set");
                    Set<Map.Entry<String, String>> contexts = ImmutableSet
                            .copyOf(args.<Map.Entry<String, String>>getAll("context"));
                    SubjectCache dataCache = args.hasAny("transient")
                            ? pex.getTransientSubjects(subject.getKey())
                            : pex.getSubjects(subject.getKey());
                    ImmutableSubjectData data = getSubjectData(dataCache, subject.getValue());
                    final String key = args.getOne("key");
                    final String value = args.getOne("value");
                    if (value == null) {
                        messageSubjectOnFuture(
                                dataCache.set(subject.getValue(), data.setOption(contexts, key, null)), src,
                                t("Unset option '%s' for %s in %s context", key,
                                        src.fmt().hl(src.fmt().subject(subject)),
                                        formatContexts(src, contexts)));
                    } else {
                        messageSubjectOnFuture(
                                dataCache.set(subject.getValue(), data.setOption(contexts, key, value)), src,
                                t("Set option %s for %s in %s context", src.fmt().option(key, value),
                                        src.fmt().hl(src.fmt().subject(subject)),
                                        formatContexts(src, contexts)));
                    }
                }
            }).build();

}

From source file:com.proofpoint.jaxrs.BeanValidationException.java

public BeanValidationException(Set<ConstraintViolation<Object>> violations) {
    super(messagesFor(violations).toString());
    this.violations = ImmutableSet.copyOf(violations);
}