List of usage examples for com.google.common.collect ImmutableSet of
public static <E> ImmutableSet<E> of(E element)
From source file:org.asoem.greyfish.impl.environment.DefaultBasic2DEnvironment.java
public static Builder builder(final BasicTiled2DSpace space, final Basic2DAgent prototype) { return new Builder(space, ImmutableSet.of(prototype)); }
From source file:com.twitter.aurora.scheduler.quota.Quotas.java
/** * Determines the amount of quota required for a set of job tasks. * * @param taskConfig Task template to count quota from. * @return Quota requirement to run {@code job}. *//*from www. ja va 2 s . co m*/ public static IQuota fromTasks(ITaskConfig taskConfig, int instanceCount) { return scale(fromProductionTasks(ImmutableSet.of(taskConfig)), instanceCount); }
From source file:com.facebook.buck.rust.RustLinkables.java
static ImmutableSortedSet<Path> getDependencyPaths(BuildRule rule) { final ImmutableSortedSet.Builder<Path> builder = ImmutableSortedSet.naturalOrder(); new AbstractBreadthFirstTraversal<BuildRule>(ImmutableSet.of(rule)) { @Override/*from w w w . ja va2s. c o m*/ public ImmutableSet<BuildRule> visit(BuildRule rule) { if (rule instanceof RustLinkable) { RustLinkable linkable = (RustLinkable) rule; builder.add(linkable.getLinkPath().getParent()); return rule.getDeps(); } else { return ImmutableSet.of(); } } }.start(); return builder.build(); }
From source file:com.facebook.buck.io.FileFinder.java
/** * Combines prefixes, base, and suffixes to create a set of file names. * @param prefixes set of prefixes. May be null or empty. * @param base base name. May be empty.// w ww . j a v a 2 s . c om * @param suffixes set of suffixes. May be null or empty. * @return a set containing all combinations of prefix, base, and suffix. */ public static ImmutableSet<String> combine(@Nullable Set<String> prefixes, String base, @Nullable Set<String> suffixes) { ImmutableSet<String> suffixedSet; if (suffixes == null || suffixes.isEmpty()) { suffixedSet = ImmutableSet.of(base); } else { ImmutableSet.Builder<String> suffixedBuilder = ImmutableSet.builder(); for (String suffix : suffixes) { suffixedBuilder.add(base + suffix); } suffixedSet = suffixedBuilder.build(); } if (prefixes == null || prefixes.isEmpty()) { return suffixedSet; } else { ImmutableSet.Builder<String> builder = ImmutableSet.builder(); for (String prefix : prefixes) { for (String suffix : suffixedSet) { builder.add(prefix + suffix); } } return builder.build(); } }
From source file:com.facebook.buck.httpserver.IndexHandlerDelegate.java
IndexHandlerDelegate() {
super(ImmutableSet.of("index.soy"));
}
From source file:com.github.benmanes.caffeine.cache.simulator.policy.product.ElasticSearchPolicy.java
/** Returns all variations of this policy based on the configuration parameters. */ public static Set<Policy> policies(Config config) { return ImmutableSet.of(new ElasticSearchPolicy(config)); }
From source file:io.ytcode.reflect.resource.Scanner.java
public static Scanner paths(String... paths) { return from(ImmutableSet.of(Thread.currentThread().getContextClassLoader()), ImmutableSet.copyOf(paths), true);//from ww w . j a v a 2s . c o m }
From source file:org.projectbuendia.client.events.user.UserAddedEvent.java
public UserAddedEvent(User addedUser) { super(ImmutableSet.of(addedUser), ImmutableSet.<User>of()); this.addedUser = addedUser; }
From source file:org.codice.ddf.catalog.ui.security.ShareableMetacardSharingPolicyPlugin.java
private static Map<String, Set<String>> getShareablePermissions() { ImmutableMap.Builder<String, Set<String>> builder = new ImmutableMap.Builder<>(); Constants.SHAREABLE_TAGS.forEach(t -> builder.put(t, ImmutableSet.of(t))); return builder.build(); }
From source file:com.google.gerrit.server.index.IndexUtils.java
public static Set<String> accountFields(QueryOptions opts) { Set<String> fs = opts.fields(); return fs.contains(AccountField.ID.getName()) ? fs : Sets.union(fs, ImmutableSet.of(AccountField.ID.getName())); }