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:ninja.leaping.permissionsex.command.ParentCommands.java

private static CommandSpec getAddParentCommand(final PermissionsEx pex) {
    return CommandSpec.builder().setAliases("add", "a", "+")
            .setArguments(subject(t("parent"), pex, PermissionsEx.SUBJECTS_GROUP))
            .setExecutor(new PermissionsExExecutor(pex) {
                @Override//from  www .  j a va 2  s  . c  om
                public <TextType> void execute(Commander<TextType> src, CommandContext args)
                        throws CommandException {
                    Map.Entry<String, String> subject = subjectOrSelf(src, args);
                    checkSubjectPermission(src, subject, "permissionsex.parent.add");
                    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());
                    Map.Entry<String, String> parent = args.getOne("parent");
                    messageSubjectOnFuture(
                            dataCache.set(subject.getValue(),
                                    data.addParent(contexts, parent.getKey(), parent.getValue())),
                            src, t("Added parent %s for %s in %s context", src.fmt().subject(parent),
                                    src.fmt().hl(src.fmt().subject(subject)), formatContexts(src, contexts)));
                }
            }).build();
}

From source file:org.onosproject.cluster.Partition.java

public Partition(String name, Collection<NodeId> members) {
    this.name = checkNotNull(name);
    this.members = ImmutableSet.copyOf(checkNotNull(members));
}

From source file:com.zaradai.config.InMemoryConfigurationSource.java

protected Set<String> getKeys() {
    return ImmutableSet.copyOf(configurationData.keySet());
}

From source file:com.google.appengine.demos.websocketchat.message.ParticipantListMessage.java

/**
 * Creates a ParticipantListMessage instance with the given parameters.
 *
 * @param room a name of the chat room.//ww w  .  j  a v  a2  s  . c  o m
 * @param participantSet a set of the names of the participants.
 */
public ParticipantListMessage(String room, Set<String> participantSet) {
    this.type = MessageType.PARTICIPANTS;
    this.room = room;
    this.participantSet = ImmutableSet.copyOf(participantSet);
}

From source file:io.prestosql.connector.informationSchema.InformationSchemaTableLayoutHandle.java

@JsonCreator
public InformationSchemaTableLayoutHandle(@JsonProperty("table") InformationSchemaTableHandle table,
        @JsonProperty("prefixes") Set<QualifiedTablePrefix> prefixes) {
    this.table = requireNonNull(table, "table is null");
    this.prefixes = ImmutableSet.copyOf(requireNonNull(prefixes, "prefixes is null"));
}

From source file:com.android.builder.files.RelativeFiles.java

/**
 * Loads all files in a directory recursively, filtering the results with a predicate.
 * Filtering is only done at the end so, even if a directory is excluded from the filter,
 * its files will be included if they are accepted by the filter.
 *
 * @param directory the directory, must exist and be a readable directory
 * @param filter a predicate to filter which files should be included in the result; only
 * files to whom the filter application results in {@code true} are included in the result
 * @return all files in the directory, sub-directories included
 *//*from  ww w . j  av a  2s . c  om*/
@NonNull
public static ImmutableSet<RelativeFile> fromDirectory(@NonNull File directory,
        @NonNull final Predicate<RelativeFile> filter) {
    return ImmutableSet.copyOf(Sets.filter(fromDirectory(directory, directory), filter));
}

From source file:com.b2international.index.mapping.Mappings.java

public Mappings(Class<?>... types) {
    this(ImmutableSet.copyOf(types));
}

From source file:org.apache.aurora.common.args.parsers.SetParser.java

@Override
Set<?> doParse(final ParserOracle parserOracle, String raw, List<Type> typeParams) {
    final Type setType = typeParams.get(0);
    final Parser<?> parser = parserOracle.get(TypeToken.of(setType));

    return ImmutableSet.copyOf(Iterables.transform(Parsers.MULTI_VALUE_SPLITTER.split(raw),
            raw1 -> parser.parse(parserOracle, setType, raw1)));
}

From source file:adept.common.ScriptEvent.java

private ScriptEvent(IType eventType, Iterable<ScriptEventArgument> arguments) {
    this.eventType = eventType;
    this.scriptEventArguments = ImmutableSet.copyOf(arguments);
}

From source file:works.chatterbox.chatterbox.commands.CommandHandler.java

@NotNull
public Set<CommandCoupling> getCommands() {
    return ImmutableSet.copyOf(this.commands);
}