List of usage examples for com.google.common.collect ImmutableSet of
public static <E> ImmutableSet<E> of(E element)
From source file:org.graylog2.streams.events.StreamsChangedEvent.java
public static StreamsChangedEvent create(String streamId) { return create(ImmutableSet.of(streamId)); }
From source file:com.facebook.buck.io.file.FileFinder.java
/** * Combines prefixes, base, and suffixes to create a set of file names. * * @param prefixes set of prefixes. May be empty. * @param base base name. May be empty./*from w w w. j ava2s .co m*/ * @param suffixes set of suffixes. May be empty. * @return a set containing all combinations of prefix, base, and suffix. */ public static ImmutableSet<String> combine(Set<String> prefixes, String base, Set<String> suffixes) { ImmutableSet<String> suffixedSet; if (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.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:org.jclouds.collect.PagedIterables.java
/** * @param only//from w ww.j a va 2 s .c om * the only page of data * * @return iterable with only the one page */ public static <T> PagedIterable<T> onlyPage(final IterableWithMarker<T> only) { return new PagedIterable<T>() { public Iterator<IterableWithMarker<T>> iterator() { return ImmutableSet.of(only).iterator(); } }; }
From source file:com.github.benmanes.caffeine.cache.simulator.policy.opt.UnboundedPolicy.java
/** Returns all variations of this policy based on the configuration parameters. */ public static Set<Policy> policies(Config config) { return ImmutableSet.of(new UnboundedPolicy()); }
From source file:org.apache.shindig.gadgets.rewrite.lexer.LinkingTagRewriter.java
public static Map<String, Set<String>> getDefaultTargets() { return new ImmutableMap.Builder<String, Set<String>>().put("img", ImmutableSet.of("src")) .put("embed", ImmutableSet.of("src")).put("link", ImmutableSet.of("href")).build(); }
From source file:com.opengamma.livedata.normalization.UnitChange.java
public UnitChange(String field, double multiplier) { ArgumentChecker.notNull(field, "Field name"); _fields = ImmutableSet.of(field); _multiplier = multiplier; }
From source file:com.github.benmanes.caffeine.cache.simulator.policy.sketch.tinycache.TinyCachePolicy.java
/** Returns all variations of this policy based on the configuration parameters. */ public static Set<Policy> policies(Config config) { return ImmutableSet.of(new TinyCachePolicy(config)); }
From source file:de.metas.ui.web.login.json.JSONLoginAuthResponse.java
public static final JSONLoginAuthResponse loginComplete(final JSONLoginRole role) { Check.assumeNotNull(role, "Parameter role is not null"); final Set<JSONLoginRole> roles = ImmutableSet.of(role); final boolean loginComplete = true; return new JSONLoginAuthResponse(roles, loginComplete); }
From source file:com.github.benmanes.caffeine.cache.simulator.policy.product.RapidoidPolicy.java
/** Returns all variations of this policy based on the configuration parameters. */ public static Set<Policy> policies(Config config) { return ImmutableSet.of(new RapidoidPolicy(config)); }
From source file:com.facebook.buck.command.config.AbstractConfigIgnoredByDaemon.java
private static ImmutableMap<String, ImmutableSet<String>> getIgnoreFieldsForDaemonRestart() { ImmutableMap.Builder<String, ImmutableSet<String>> ignoreFieldsForDaemonRestartBuilder = ImmutableMap .builder();//w w w . j ava 2s . c o m ignoreFieldsForDaemonRestartBuilder.put("apple", ImmutableSet.of("generate_header_symlink_tree_only")); ignoreFieldsForDaemonRestartBuilder.put("build", ImmutableSet.of("threads")); ignoreFieldsForDaemonRestartBuilder.put("cache", ImmutableSet.of("dir", "dir_mode", "http_mode", "http_url", "mode", "slb_server_pool")); ignoreFieldsForDaemonRestartBuilder.put("client", ImmutableSet.of("id", "skip-action-graph-cache")); ignoreFieldsForDaemonRestartBuilder.put("intellij", ImmutableSet.of("multi_cell_module_support")); ignoreFieldsForDaemonRestartBuilder.put("log", ImmutableSet.of("chrome_trace_generation", "compress_traces", "max_traces", "public_announcements", "log_build_id_to_console_enabled", "build_details_template")); ignoreFieldsForDaemonRestartBuilder.put("project", ImmutableSet.of("ide_prompt", "ide_force_kill")); ignoreFieldsForDaemonRestartBuilder.put("ui", ImmutableSet.of("superconsole", "thread_line_limit", "thread_line_output_max_columns", "warn_on_config_file_overrides", "warn_on_config_file_overrides_ignored_files")); ignoreFieldsForDaemonRestartBuilder.put("color", ImmutableSet.of("ui")); ignoreFieldsForDaemonRestartBuilder.put("version_control", ImmutableSet.of("generate_statistics")); return ignoreFieldsForDaemonRestartBuilder.build(); }