List of usage examples for com.google.common.collect Sets newHashSet
public static <E> HashSet<E> newHashSet(Iterator<? extends E> elements)
From source file:com.spotify.helios.cli.command.HostResolver.java
static HostResolver create(HeliosClient client) throws InterruptedException, ExecutionException { final ResolverConfig currentConfig = ResolverConfig.getCurrentConfig(); final Name[] path; if (currentConfig != null) { final Name[] possiblePath = currentConfig.searchPath(); if (possiblePath != null) { path = possiblePath;// w ww. j av a2 s .c o m } else { path = EMPTY_PATH; } } else { path = EMPTY_PATH; } return new HostResolver(Sets.newHashSet(client.listHosts().get()), path); }
From source file:org.wikimedia.cassandra.metrics.service.Stats.java
Collection<String> getNames() { Set<String> names = Sets.newHashSet(this.successes.keySet()); names.addAll(this.failures.keySet()); return names; }
From source file:tech.beshu.ror.acl.blocks.rules.impl.ZeroKnowledgeMatchFilter.java
static public Set<String> alterIndicesIfNecessary(Set<String> indices, MatcherWithWildcards matcher) { boolean shouldReplace = false; indices = Sets.newHashSet(indices); if (indices.contains("_all")) { indices.remove("_all"); indices.add("*"); }/*w w w . j a va 2 s . c o m*/ if (indices.size() == 0) { indices.add("*"); } if (indices.contains("*")) { if (indices.size() == 1) { return matcher.getMatchers().stream().collect(Collectors.toSet()); } else { shouldReplace = true; indices.remove("*"); indices.addAll(matcher.getMatchers().stream().collect(Collectors.toSet())); } } Set<String> newIndices = Sets.newHashSet(); for (String i : indices) { if (matcher.match(i)) { newIndices.add(i); continue; } MatcherWithWildcards revMatcher = new MatcherWithWildcards(Sets.newHashSet(i)); Set<String> matched = revMatcher.filter(matcher.getMatchers()); if (!matched.isEmpty()) { newIndices.addAll(matched); shouldReplace = true; } } if (shouldReplace || !Sets.symmetricDifference(newIndices, indices).isEmpty()) { return newIndices; } else { // This means you don't need to replace at all. return null; } }
From source file:io.github.aritzhack.aritzh.logging.MultiLogger.java
public MultiLogger(ILogger... loggers) { this.loggers = Sets.newHashSet(loggers); }
From source file:info.archinnov.achilles.entity.metadata.util.PropertyTypeExclude.java
public PropertyTypeExclude(PropertyType... types) { this.typesToExclude = Sets.newHashSet(types); }
From source file:info.archinnov.achilles.internal.metadata.util.PropertyTypeFilter.java
public PropertyTypeFilter(PropertyType... types) { this.types = Sets.newHashSet(types); }
From source file:com.flaptor.indextank.IndexTankTestCase.java
public static void assertSameSets(String message, Iterable<?> expected, Iterable<?> actaul) { assertEquals(message, Sets.newHashSet(expected), Sets.newHashSet(actaul)); }
From source file:org.obiba.mica.dataset.search.rest.harmonization.ContingencyUtils.java
public static List<String> getTermsHeaders(DatasetVariable variable, Mica.DatasetVariableContingencyDto dto) { List<String> terms = variable.getCategories() != null ? variable.getCategories().stream().map(c -> c.getName()).collect(toList()) : Lists.newArrayList();/*from w w w. jav a 2 s . c om*/ List<String> dtoTerms = dto.getAggregationsList().stream().map(a -> a.getTerm()) .collect(Collectors.toList()); terms.addAll(Sets.difference(Sets.newHashSet(dtoTerms), Sets.newHashSet(terms))); return terms; }
From source file:com.codereligion.diff.util.ExcludeSerializer.java
public ExcludeSerializer(final Class<?>... excludedTypes) { this.excludedTypes = Sets.newHashSet(excludedTypes); }
From source file:com.codereligion.diff.util.IncludeSerializer.java
public IncludeSerializer(final Class<?>... includedTypes) { this.includedTypes = Sets.newHashSet(includedTypes); }