List of usage examples for com.google.common.collect ImmutableSortedSet copyOf
public static <E extends Comparable<? super E>> ImmutableSortedSet<E> copyOf(E[] elements)
From source file:com.bodybuilding.turbine.discovery.ClusterListUtil.java
public static SortedSet<String> getClusterNames() { return ImmutableSortedSet.copyOf(InstanceObservable.getInstance().getCurrentHostsUp().stream() .map(Instance::getCluster).filter(c -> { ClusterMonitor<? extends TurbineData> cm = PluginsFactory.getClusterMonitorFactory() .getClusterMonitor(c); if (cm == null) { log.info("ClusterMonitor does not know about cluster with name: {}", c); }/*from w ww .j a v a 2 s. c o m*/ return cm != null; }).collect(Collectors.toSet())); }
From source file:edu.umn.nlptab.uimatyping.TypeFilterLists.java
public static TypeFilterLists create(String[] typeWhitelist, String[] typeBlacklist) { ImmutableSet<String> whitelistSet; if (typeWhitelist.length == 0) { whitelistSet = ImmutableSortedSet.of(CAS.TYPE_NAME_TOP); } else {//from www .j av a2 s. co m whitelistSet = ImmutableSortedSet.copyOf(typeWhitelist); } ImmutableSet<String> blacklistSet = ImmutableSortedSet.copyOf(typeBlacklist); return new TypeFilterLists(whitelistSet, blacklistSet); }
From source file:com.facebook.buck.hashing.PathHashing.java
public static ImmutableSet<Path> hashPath(Hasher hasher, FileHashLoader fileHashLoader, ProjectFilesystem projectFilesystem, Path root) throws IOException { Preconditions.checkArgument(!root.equals(EMPTY_PATH), "Path to hash (%s) must not be empty", root); ImmutableSet.Builder<Path> children = ImmutableSet.builder(); for (Path path : ImmutableSortedSet.copyOf(projectFilesystem.getFilesUnderPath(root))) { StringHashing.hashStringAndLength(hasher, MorePaths.pathWithUnixSeparators(path)); if (!root.equals(path)) { children.add(root.relativize(path)); }/*from ww w. j av a2s . c om*/ hasher.putBytes(fileHashLoader.get(projectFilesystem.resolve(path)).asBytes()); } return children.build(); }
From source file:com.facebook.buck.util.hashing.PathHashing.java
public static ImmutableSet<Path> hashPath(Hasher hasher, ProjectFileHashLoader fileHashLoader, ProjectFilesystem projectFilesystem, Path root) throws IOException { Preconditions.checkArgument(!root.equals(EMPTY_PATH), "Path to hash (%s) must not be empty", root); ImmutableSet.Builder<Path> children = ImmutableSet.builder(); for (Path path : ImmutableSortedSet.copyOf(projectFilesystem.getFilesUnderPath(root))) { StringHashing.hashStringAndLength(hasher, MorePaths.pathWithUnixSeparators(path)); if (!root.equals(path)) { children.add(root.relativize(path)); }//ww w . j av a 2 s .c om hasher.putBytes(fileHashLoader.get(path).asBytes()); } return children.build(); }
From source file:com.facebook.buck.rules.coercer.SortedSetConcatable.java
@Override public ImmutableSortedSet<T> concat(Iterable<ImmutableSortedSet<T>> elements) { return ImmutableSortedSet.copyOf(Iterables.concat(elements)); }
From source file:com.facebook.buck.rules.FakeExportDependenciesRule.java
public FakeExportDependenciesRule(String target, SourcePathResolver resolver, BuildRule... deps) { super(target, resolver, deps); this.exportedDeps = ImmutableSortedSet.copyOf(deps); }
From source file:google.registry.monitoring.metrics.CustomFitter.java
/** * Create a new {@link CustomFitter} with the given interval boundaries. * * @param boundaries is a sorted list of interval boundaries * @throws IllegalArgumentException if {@code boundaries} is empty or not sorted in ascending * order, or if a value in the set is infinite, {@code NaN}, or {@code -0.0}. *//*from ww w. ja v a2 s .co m*/ public static CustomFitter create(ImmutableSet<Double> boundaries) { checkArgument(boundaries.size() > 0, "boundaries must not be empty"); checkArgument(Ordering.natural().isOrdered(boundaries), "boundaries must be sorted"); for (Double d : boundaries) { checkDouble(d); } return new AutoValue_CustomFitter(ImmutableSortedSet.copyOf(boundaries)); }
From source file:com.facebook.buck.cli.CommandHelper.java
public static void printToConsole(CommandRunnerParams params, Multimap<String, QueryTarget> targetsAndDependencies) { for (QueryTarget target : ImmutableSortedSet.copyOf(targetsAndDependencies.values())) { params.getConsole().getStdOut().println(target); }/*w ww . j a v a 2s .c o m*/ }
From source file:io.druid.data.input.Rows.java
/** * @param timeStamp rollup up timestamp to be used to create group key * @param inputRow input row/* w w w.j a v a2s .co m*/ * @return groupKey for the given input row */ public static List<Object> toGroupKey(long timeStamp, InputRow inputRow) { final Map<String, Set<String>> dims = Maps.newTreeMap(); for (final String dim : inputRow.getDimensions()) { final Set<String> dimValues = ImmutableSortedSet.copyOf(inputRow.getDimension(dim)); if (dimValues.size() > 0) { dims.put(dim, dimValues); } } return ImmutableList.of(timeStamp, dims); }
From source file:com.github.steveash.typedconfig.resolver.type.container.SortedSetValueResolverFactory.java
@Override protected Object makeReturnValueFrom(Collection<Object> containedValues, ConfigBinding binding) { return ImmutableSortedSet.copyOf(containedValues); }