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

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

Introduction

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

Prototype

public static <E extends Comparable<? super E>> ImmutableSortedSet<E> copyOf(E[] elements) 

Source Link

Usage

From source file:com.facebook.buck.android.UnstrippedNativeLibraries.java

UnstrippedNativeLibraries(BuildTarget buildTarget, ProjectFilesystem projectFilesystem,
        BuildRuleParams buildRuleParams, SourcePathRuleFinder ruleFinder,
        ImmutableSortedSet<SourcePath> inputs) {
    super(buildTarget, projectFilesystem, buildRuleParams.withoutExtraDeps()
            .withDeclaredDeps(ImmutableSortedSet.copyOf(ruleFinder.filterBuildRuleInputs(inputs))));
    this.inputs = inputs;
}

From source file:org.ldp4j.tutorial.client.Links.java

SortedSet<Link> all() {
    return ImmutableSortedSet.copyOf(this.links.values());
}

From source file:org.sosy_lab.cpachecker.cfa.ImmutableCFA.java

ImmutableCFA(MachineModel pMachineModel, Map<String, FunctionEntryNode> pFunctions,
        SetMultimap<String, CFANode> pAllNodes, FunctionEntryNode pMainFunction,
        Optional<LoopStructure> pLoopStructure, Optional<VariableClassification> pVarClassification,
        Optional<LiveVariables> pLiveVariables, Language pLanguage) {

    machineModel = pMachineModel;//from www  . ja  v  a  2 s .co m
    functions = ImmutableSortedMap.copyOf(pFunctions);
    allNodes = ImmutableSortedSet.copyOf(pAllNodes.values());
    mainFunction = checkNotNull(pMainFunction);
    loopStructure = pLoopStructure;
    varClassification = pVarClassification;
    liveVariables = pLiveVariables;
    language = pLanguage;

    checkArgument(functions.get(mainFunction.getFunctionName()) == mainFunction);
}

From source file:io.github.mywarp.mywarp.bukkit.BukkitLimitCapability.java

/**
 * Initializes this provider.//  w  ww  . j  a va 2  s.  c o m
 *
 * @param configuredLimits the configured FeeBundles that are assigned to a player via a specific permission
 * @param defaultLimit     the default FeeBundle that acts as a fallback if a player has none of the specific
 *                         permissions
 */
BukkitLimitCapability(Iterable<LimitBundle> configuredLimits, LimitBundle defaultLimit) {
    this.configuredLimits = ImmutableSortedSet.copyOf(configuredLimits);
    this.defaultLimit = defaultLimit;

    for (ValueBundle bundle : configuredLimits) {
        BukkitPermissionsRegistration.INSTANCE
                .register(new Permission(bundle.getPermission(), PermissionDefault.FALSE));
    }

    // register per-world overrides
    String base = "mywarp.limit.disobey";

    for (World world : Bukkit.getWorlds()) {
        // mywarp.limit.disobey.[WORLDNAME].*
        Permission worldPerm = new Permission(base + "." + world.getName() + ".*");
        worldPerm.addParent(base + ".*", true);
        BukkitPermissionsRegistration.INSTANCE.register(worldPerm);

        // mywarp.limit.disobey.[WORLDNAME].total etc.
        for (String type : Arrays.asList("total", "private", "public")) {
            Permission perm = new Permission(base + "." + world.getName() + "." + type);
            perm.addParent(worldPerm, true);
            BukkitPermissionsRegistration.INSTANCE.register(perm);
        }
    }
}

From source file:org.apache.aurora.scheduler.http.api.security.ShiroIniParser.java

@Override
public Ini doParse(String raw) throws IllegalArgumentException {
    Ini ini;/*from  w w w.j  a  va 2s .  c  o m*/
    try {
        ini = Ini.fromResourcePath(raw);
    } catch (ConfigurationException e) {
        throw new ShiroConfigurationException(e);
    }

    Set<String> presentSections = ImmutableSortedSet.copyOf(ini.getSectionNames());
    if (presentSections.isEmpty()) {
        throw new MissingSectionsException();
    }

    Set<String> extraSections = Sets.difference(presentSections, ALLOWED_SECTION_NAMES);
    if (!extraSections.isEmpty()) {
        throw new ExtraSectionsException(extraSections);
    }

    return ini;
}

From source file:com.facebook.buck.android.MergeThirdPartyJarResources.java

protected MergeThirdPartyJarResources(BuildTarget buildTarget, ProjectFilesystem projectFilesystem,
        SourcePathRuleFinder ruleFinder, ImmutableCollection<SourcePath> pathsToThirdPartyJars) {
    super(buildTarget, projectFilesystem, ruleFinder, MergeThirdPartyJarResources.class);
    this.pathsToThirdPartyJars = ImmutableSortedSet.copyOf(pathsToThirdPartyJars);
    this.mergedPath = new OutputPath("java.resources");
}

From source file:com.facebook.buck.java.AnnotationProcessingParams.java

private AnnotationProcessingParams(@Nullable BuildTarget ownerTarget, Set<Path> searchPathElements,
        Set<String> names, Set<String> parameters, Set<BuildRule> rules, boolean processOnly) {
    this.ownerTarget = ownerTarget;
    this.searchPathElements = ImmutableSortedSet.copyOf(searchPathElements);
    this.names = ImmutableSortedSet.copyOf(names);
    this.parameters = ImmutableSortedSet.copyOf(parameters);
    this.rules = ImmutableSortedSet.copyOf(rules);
    this.processOnly = processOnly;
}

From source file:org.pircbotx.UserChannelMap.java

public ImmutableSortedSet<C> getChannels(U user) {
    return ImmutableSortedSet.copyOf(userToChannelMap.get(user));
}

From source file:de.unentscheidbar.validation.internal.Collections3.java

/**
 * Returns an immutable version of the given collection and tries to preserve any special
 * properties of that collection. Lists are converted to immutable lists, Sets are converted to
 * immutable sets, sorted sets to immutable sorted sets, etc.
 * <p>//from  www  . j  av a2s .co m
 * If the specialization of the given collection is not recognized, it is converted to an
 * immutable list.
 * </p>
 * 
 * @param c
 *            The collection that
 * @return An immutable version of the given collection or {@code null} iff {@code c} was
 *         {@code null}.
 */
public static <C> Collection<C> immutableCopyOf(@Nullable Collection<C> c) {

    if (c == null)
        return null;
    /* Most common cases first */
    if (c instanceof List<?>) {
        return ImmutableList.copyOf(c);
    } else if (c instanceof Set<?>) {
        return ImmutableSet.copyOf(c);
    } else if (c instanceof SortedSet<?>) {
        return ImmutableSortedSet.copyOf(c);
    } else if (c instanceof Multiset<?>) {
        return ImmutableMultiset.copyOf(c);
    } else {
        return ImmutableList.copyOf(c);
    }
}

From source file:org.auraframework.impl.css.token.StyleContextImpl.java

/**
 * Creates a new instance of {@link StyleContext}. Note that client will be lower-cased for string comparison
 * purposes./*  w  ww .  java2 s . c om*/
 *
 * @param client The client (e.g., browser).
 * @param extraTrueConditions Other unnamed true conditions, e.g., "isDesktop".
 * @param tokens The token overrides from the application.
 */
private StyleContextImpl(String client, Iterable<String> extraTrueConditions, TokenCache tokens) {
    checkNotNull(client, "client cannot be null");
    this.client = client.toLowerCase();

    this.extraTrueConditions = (extraTrueConditions != null) ? ImmutableSortedSet.copyOf(extraTrueConditions)
            : ImmutableSet.<String>of();

    this.tokens = tokens != null ? tokens : EmptyTokenCache.INSTANCE;
}