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:org.jclouds.ultradns.ws.xml.DirectionalGroupHandler.java

@Override
public void startElement(String url, String name, String qName, Attributes attrs) {
    if (equalsOrSuffix(qName, "DirectionalDNSGroupDetail")) {
        group.name(attrs.getValue("GroupName"));
        group.description(attrs.getValue("Description"));
    } else if (equalsOrSuffix(qName, "RegionForNewGroups")) {
        String regionName = attrs.getValue("RegionName");
        Iterable<String> territories = Splitter.on(';').split(attrs.getValue("TerritoryName"));
        // for some reason, this isn't sorted here, though it is in other parts of the api.  manually sort.
        group.mapRegionToTerritories(regionName, ImmutableSortedSet.copyOf(territories));
    }/*from   w  ww . j  a v a2  s  .  c  o  m*/
}

From source file:com.facebook.buck.jvm.java.abi.ClassReferenceTracker.java

public SortedSet<String> getReferencedClassNames() {
    return ImmutableSortedSet.copyOf(referencedClassNames);
}

From source file:com.facebook.buck.python.PythonLibraryRule.java

protected PythonLibraryRule(BuildRuleParams buildRuleParams, ImmutableSortedSet<String> srcs) {
    super(buildRuleParams);
    this.srcs = ImmutableSortedSet.copyOf(srcs);

    if (srcs.isEmpty()) {
        this.pythonPathDirectory = Optional.absent();
    } else {// w  w  w.j  a  v a  2  s.  c  o  m
        this.pythonPathDirectory = Optional.of(getPathToPythonPathDirectory());
    }
}

From source file:com.android.builder.internal.compiler.DxDexKey.java

private DxDexKey(@NonNull File sourceFile, @NonNull Revision buildToolsRevision, boolean jumboMode,
        boolean optimize, @NonNull Iterable<String> additionalParameters, @Nullable Boolean isMultiDex) {
    super(sourceFile, buildToolsRevision, jumboMode, optimize);
    mAdditionalParameters = ImmutableSortedSet.copyOf(additionalParameters);
    ;//w ww .j  a va  2s. co m
    mIsMultiDex = isMultiDex;
}

From source file:com.facebook.buck.apple.toolchain.impl.AppleToolchainDiscovery.java

/**
 * Given a path to an Xcode developer directory, walks through the toolchains and builds a map of
 * (identifier: path) pairs of the toolchains inside.
 *///from  w  w  w .j  av  a 2 s. c om
public static ImmutableMap<String, AppleToolchain> discoverAppleToolchains(Optional<Path> developerDir,
        ImmutableList<Path> extraDirs) throws IOException {
    ImmutableMap.Builder<String, AppleToolchain> toolchainIdentifiersToToolchainsBuilder = ImmutableMap
            .builder();

    HashSet<Path> toolchainPaths = new HashSet<Path>(extraDirs);
    if (developerDir.isPresent()) {
        Path toolchainsDir = developerDir.get().resolve("Toolchains");
        LOG.debug("Searching for Xcode toolchains under %s", toolchainsDir);
        toolchainPaths.add(toolchainsDir);
    }

    for (Path toolchains : toolchainPaths) {
        if (!Files.exists(toolchains)) {
            LOG.debug("Skipping toolchain search path %s that does not exist", toolchains);
            continue;
        }

        LOG.debug("Searching for Xcode toolchains in %s", toolchains);

        try (DirectoryStream<Path> toolchainStream = Files.newDirectoryStream(toolchains, "*.xctoolchain")) {
            for (Path toolchainPath : ImmutableSortedSet.copyOf(toolchainStream)) {
                LOG.debug("Getting identifier for for Xcode toolchain under %s", toolchainPath);
                addIdentifierForToolchain(toolchainPath, toolchainIdentifiersToToolchainsBuilder);
            }
        }
    }

    return toolchainIdentifiersToToolchainsBuilder.build();
}

From source file:com.facebook.buck.features.project.intellij.DefaultIjModuleFactory.java

@Override
@SuppressWarnings("rawtypes") // https://github.com/immutables/immutables/issues/548 requires us to use
// TargetNode not TargetNode<?>
public IjModule createModule(Path moduleBasePath, ImmutableSet<TargetNode> targetNodes, Set<Path> excludes) {
    return createModuleUsingSortedTargetNodes(moduleBasePath, ImmutableSortedSet.copyOf(targetNodes), excludes);
}

From source file:me.taylorkelly.mywarp.bukkit.economy.BukkitFeeProvider.java

/**
 * Initializes this provider./*from www.j  ava  2  s  .  co  m*/
 *
 * @param configuredFees the configured FeeBundles that are assigned to a player via a specific permission
 * @param defaultFees    the default FeeBundle that acts as a fallback if a player has none of the specific
 *                       permissions
 */
public BukkitFeeProvider(Iterable<FeeBundle> configuredFees, FeeBundle defaultFees) {
    this.configuredFees = ImmutableSortedSet.copyOf(configuredFees);
    this.defaultFees = defaultFees;

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

From source file:io.wcm.devops.conga.resource.FileResourceCollectionImpl.java

@Override
public SortedSet<ResourceCollection> getResourceCollections() {
    if (!exists()) {
        return ImmutableSortedSet.of();
    }/*ww  w .j a v a 2 s.c  o  m*/
    return ImmutableSortedSet.copyOf(Arrays.stream(file.listFiles()).filter(child -> child.isDirectory())
            .map(child -> new FileResourceCollectionImpl(child, resourceLoader)).collect(Collectors.toList()));
}

From source file:com.spotify.heroic.common.Features.java

public static Features of(final Feature... features) {
    return new Features(ImmutableSortedSet.copyOf(features));
}

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

AppleResource(DirectoryTraverser directoryTraverser, BuildRuleParams params, AppleResourceDescriptionArg args,
        Optional<Path> outputPathSubdirectory) {
    this.directoryTraverser = Preconditions.checkNotNull(directoryTraverser);
    this.dirs = ImmutableSortedSet.copyOf(args.dirs);
    this.files = ImmutableSortedSet.copyOf(args.files);
    Preconditions.checkNotNull(outputPathSubdirectory);
    BuildTarget target = params.getBuildTarget();
    Path baseOutputDirectory = Paths.get(BuckConstant.BIN_DIR, target.getBasePath(),
            target.getShortName() + ".app"); // TODO(user): This is hokey, just a hack to get started.
    if (outputPathSubdirectory.isPresent()) {
        this.outputDirectory = baseOutputDirectory.resolve(outputPathSubdirectory.get());
    } else {/* ww w.  jav  a  2  s  .  com*/
        this.outputDirectory = baseOutputDirectory;
    }
}