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:io.soabase.admin.auth.AuthSpec.java

public AuthSpec(AuthMethod authMethod, Set<AuthFields> fields, int signInSslPort, String signInHeading,
        String signInButton) {/*from   ww w. ja  v  a2  s  .  co  m*/
    fields = Preconditions.checkNotNull(fields, "fields cannot be null");
    this.authMethod = Preconditions.checkNotNull(authMethod, "authMethod cannot be null");
    this.fields = ImmutableSet.copyOf(fields);
    this.signInSslPort = signInSslPort;
    this.signInHeading = Preconditions.checkNotNull(signInHeading, "signInHeading cannot be null");
    this.signInButton = Preconditions.checkNotNull(signInButton, "signInButton cannot be null");
}

From source file:org.eclipse.che.api.project.server.impl.ProjectConfigRegistry.java

public Set<RegisteredProject> getAll(String wsPath) {
    Set<RegisteredProject> children = projects.entrySet().stream().filter(it -> it.getKey().startsWith(wsPath))
            .filter(it -> !it.getKey().equals(wsPath)).map(Entry::getValue).collect(toSet());
    return ImmutableSet.copyOf(children);
}

From source file:de.metas.ui.web.view.json.JSONDocumentIdsSelection.java

private JSONDocumentIdsSelection(@JsonProperty("selection") final Set<String> selection) {
    this.selection = selection == null ? ImmutableSet.of() : ImmutableSet.copyOf(selection);
}

From source file:com.brighttag.agathon.service.impl.ServiceRegistry.java

@Inject
public ServiceRegistry(Set<Service> services) {
    this.services = ImmutableSet.copyOf(services);
}

From source file:com.android.tools.idea.gradle.editor.entity.AbstractGradleEditorEntity.java

protected AbstractGradleEditorEntity(@NotNull GradleEditorSourceBinding entityLocation,
        @NotNull Set<GradleEditorEntityMetaData> metaData, @Nullable String helpUrl) {
    myEntityLocation = entityLocation;//from  ww  w . j a v  a2 s .co m
    myMetaData = ImmutableSet.copyOf(metaData);
    myHelpUrl = helpUrl;
}

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

public static CommandSpec getPermissionCommand(final PermissionsEx pex) {
    return CommandSpec.builder().setAliases("permission", "permissions", "perm", "perms", "p")
            .setArguments(seq(string(t("key")), permissionValue(t("value"))))
            .setExecutor(new PermissionsExExecutor(pex) {
                @Override/*from   w ww.ja v  a2s.  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.permission.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");
                    Object value = args.getOne("value");
                    if (value instanceof Boolean) {
                        value = ((Boolean) value) ? 1 : -1;
                    }
                    int intVal = (Integer) value;

                    messageSubjectOnFuture(
                            dataCache.set(subject.getValue(), data.setPermission(contexts, key, intVal)), src,
                            t("Set permission %s for %s in %s context", src.fmt().permission(key, intVal),
                                    src.fmt().hl(src.fmt().subject(subject)), formatContexts(src, contexts)));
                }
            }).build();
}

From source file:com.b2international.index.lucene.FloatIndexField.java

@Override
protected Query toSetQuery(Iterable<Float> values) {
    return FloatPoint.newSetQuery(fieldName(), ImmutableSet.copyOf(values));
}

From source file:io.grpc.internal.HedgingPolicy.java

/**
 * The caller is supposed to have validated the arguments and handled throwing exception or
 * logging warnings already, so we avoid repeating args check here.
 *///  ww w  .ja v  a2s . c o m
HedgingPolicy(int maxAttempts, long hedgingDelayNanos, Set<Code> nonFatalStatusCodes) {
    this.maxAttempts = maxAttempts;
    this.hedgingDelayNanos = hedgingDelayNanos;
    this.nonFatalStatusCodes = ImmutableSet.copyOf(nonFatalStatusCodes);
}

From source file:com.google.devtools.build.lib.query2.output.NullAspectResolver.java

@Override
public Set<Label> computeBuildFileDependencies(Package pkg, BuildFileDependencyMode mode)
        throws InterruptedException {
    return ImmutableSet.copyOf(mode.getDependencies(pkg));
}

From source file:org.graylog2.indexer.nosqlunit.IndexCreatingLoadStrategyFactory.java

public IndexCreatingLoadStrategyFactory(ElasticsearchConfiguration config, Set<String> indexNames) {
    this.config = config;
    this.loadStrategyFactory = new ReflectionLoadStrategyFactory();
    this.indexNames = ImmutableSet.copyOf(indexNames);
}