List of usage examples for com.google.common.collect Sets union
public static <E> SetView<E> union(final Set<? extends E> set1, final Set<? extends E> set2)
From source file:org.apache.james.mailetcontainer.impl.matchers.Xor.java
private Collection<MailAddress> performXor(Collection<MailAddress> collection1, Collection<MailAddress> collection2) { ImmutableSet<MailAddress> set1 = ImmutableSet.copyOf(collection1); ImmutableSet<MailAddress> set2 = ImmutableSet.copyOf(collection2); return Sets.difference(Sets.union(set1, set2), Sets.intersection(set1, set2)).immutableCopy(); }
From source file:org.apache.cassandra.db.index.sasi.conf.view.PrefixTermTree.java
@Override public Set<SSTableIndex> search(Expression e) { Map<ByteBuffer, Set<SSTableIndex>> indexes = (e == null || e.lower == null || mode == OnDiskIndexBuilder.Mode.SUFFIX) ? trie : trie.prefixMap(e.lower.value); Set<SSTableIndex> view = new HashSet<>(indexes.size()); for (Set<SSTableIndex> match : indexes.values()) view.addAll(match);/*from ww w .ja va2s . c o m*/ return Sets.union(view, super.search(e)); }
From source file:org.onosproject.store.resource.impl.GenericDiscreteResources.java
@Override public DiscreteResources add(DiscreteResources other) { if (other instanceof GenericDiscreteResources) { // make sure that the set is serializable return of(new LinkedHashSet<>(Sets.union(this.values(), other.values()))); } else if (other instanceof EmptyDiscreteResources) { return this; }//from w w w .ja v a 2s .c o m return DiscreteResources.of(Sets.union(this.values(), other.values())); }
From source file:dynamicrefactoring.domain.metadata.classifications.xml.imp.PluginClassificationsCatalog.java
/** * Lee las clasificaciones del usuario y del plugin de sus respectivos * ficheros xml y devuelve la union de ambas. * // ww w . j ava 2 s. c om * @return conjunto que contiene las clasificaciones de usuario y del plugin */ protected static Set<Classification> readAllClassificationsFromFiles() { final Set<Classification> pluginClassifications = AbstractCatalog .getClassificationsFromFile(PluginClassificationsCatalog.PLUGIN_CLASSIFICATION_TYPES_FILE, false); final Set<Classification> userClassifications = AbstractCatalog .getClassificationsFromFile(PluginClassificationsCatalog.USER_CLASSIFICATION_TYPES_FILE, true); return Sets.union(pluginClassifications, userClassifications); }
From source file:springfox.documentation.spring.web.plugins.CombinedRequestHandler.java
@Override public Set<? extends MediaType> consumes() { return Sets.union(first.consumes(), second.consumes()); }
From source file:org.sosy_lab.cpachecker.cfa.ast.c.CIdExpressionCollectingVisitor.java
@Override public Set<CIdExpression> visit(CInitializerList pI) throws RuntimeException { Set<CIdExpression> result = Collections.emptySet(); for (CInitializer i : pI.getInitializers()) { result = Sets.union(result, i.accept(this)); }//from w w w . j a v a 2 s.c om return result; }
From source file:org.sosy_lab.cpachecker.cfa.ast.c.FileLocationCollectingVisitor.java
@Override public Set<FileLocation> visit(CInitializerExpression pE) throws RuntimeException { return Sets.union(Collections.singleton(pE.getFileLocation()), pE.getExpression().accept(this)); }
From source file:eu.lp0.cursus.scoring.scores.base.AbstractScores.java
public AbstractScores(Set<Pilot> pilots, List<Race> races, Set<Event> events, Predicate<Pilot> fleetFilter, ScoresFactory scoresFactory, Scorer scorer) { this.pilots = ImmutableSet.copyOf(pilots); this.races = ImmutableList.copyOf(races); this.scoresFactory = scoresFactory; this.scorer = scorer.getUUID(); Preconditions.checkArgument(!this.pilots.isEmpty(), "No pilots"); //$NON-NLS-1$ Preconditions.checkArgument(!this.races.isEmpty(), "No races"); //$NON-NLS-1$ Set<Series> checkSeries = new HashSet<Series>(2); for (Pilot pilot : pilots) { checkSeries.add(pilot.getSeries()); }/*ww w . j a v a 2s.c om*/ for (Race race : races) { checkSeries.add(race.getEvent().getSeries()); } Preconditions.checkArgument(checkSeries.size() == 1, "Multiple series not allowed"); //$NON-NLS-1$ series = checkSeries.iterator().next(); // Implicitly add events from the races to the set of events Set<Event> raceEvents = new HashSet<Event>(series.getEvents().size() * 2); for (Race race : races) { raceEvents.add(race.getEvent()); } this.events = ImmutableSet.copyOf(Sets.union(events, raceEvents)); fleet = ImmutableSet.copyOf(Sets.filter(series.getPilots(), fleetFilter)); }
From source file:com.facebook.buck.cli.OwnersReport.java
OwnersReport updatedWith(OwnersReport other) { SetMultimap<TargetNode<?, ?>, Path> updatedOwners = TreeMultimap.create(owners); updatedOwners.putAll(other.owners);/*from www. j a va 2s.c o m*/ return new OwnersReport(updatedOwners, Sets.intersection(inputsWithNoOwners, other.inputsWithNoOwners), Sets.union(nonExistentInputs, other.nonExistentInputs), Sets.union(nonFileInputs, other.nonFileInputs)); }
From source file:eu.esdihumboldt.hale.common.align.model.BaseAlignmentCell.java
/** * @see eu.esdihumboldt.hale.common.align.model.Cell#getDisabledFor() *//*from w w w . j a va 2s .c om*/ @Override public Set<String> getDisabledFor() { return Collections.unmodifiableSet(new HashSet<String>(Sets.union(disabledFor, base.getDisabledFor()))); }