public void whenCalculatingUnionOfSets_thenCorrect() {
    Set<Character> first = ImmutableSet.of('a', 'b', 'c');
    Set<Character> second = ImmutableSet.of('b', 'c', 'd');
 
    Set<Character> union = Sets.union(first, second);
    assertThat(union, containsInAnyOrder('a', 'b', 'c', 'd'));
}

        

class GFG { 
  
    // Driver's code 
    public static void main(String[] args) 
    { 
        // Creating first set 
        Set<String> 
            set1 = Sets.newHashSet("G", "e", "e", "k", "s"); 
  
        // Creating second set 
        Set<String> 
            set2 = Sets.newHashSet("g", "f", "G", "e"); 
  
        // Using Guava's Sets.union() method 
        Set<String> 
            answer = Sets.union(set1, set2); 
  
        // Displaying the union of set set1 and set2 
        System.out.println("Set 1: "
                           + set1); 
        System.out.println("Set 2: "
                           + set2); 
        System.out.println("Set 1 union Set 2: "
                           + answer); 
    } 
} 

        

public static void main(String[] args) { 
	// Given sets
	Set<Character> ab = ImmutableSet.of('a', 'b');
	Set<Character> bc = ImmutableSet.of('b', 'c');
 
	// Union of two sets
	Sets.union(ab, bc);                 // -> [a, b, c]
}

        

public class SetsUnionTest {
  public static void main(String[] args) {
    ImmutableSet<String> stringSet = ImmutableSet.of("ONE", "TWO", "THREE");
    System.out.println(stringSet);
    
    ImmutableSet<String> stringSet2 = ImmutableSet.of("TWO", "THREE", "FOUR");
    System.out.println(stringSet2);
    
    Set<String> resultSet = Sets.union(stringSet, stringSet2);
    System.out.println(resultSet);
  }

}

        

public static void main(String[] args) {
	Set<int> a = Sets.newHashSet(1, 2, 3, 4);
	Set<int> b = Sets.newHashSet(2, 3, 4, 5);
	Sets.setView sv = Sets.union(a, b);
	// sv = {1, 2, 3, 4, 5}
}

        

public ViewChanges droppingAlso(Collection<View> extraViewsToDrop) {
  Set<String> extraViewNames = ImmutableSet.copyOf(Collections2.transform(extraViewsToDrop, viewToName()));

  // -- In case we have any new obsolete views in here, we need to make sure they're in the index...
  //
  Map<String, View> newIndex = new HashMap<>();
  newIndex.putAll(uniqueIndex(extraViewsToDrop, viewToName()));
  newIndex.putAll(viewIndex);

  return new ViewChanges(allViews,
    Sets.union(dropSet, extraViewNames),
    Sets.union(deploySet, Sets.intersection(extraViewNames, knownSet)),
    newIndex);
}

        

public Set<Link> getLinks(ConnectPoint connectPoint) {
    checkPermission(LINK_READ);
    checkNotNull(connectPoint, CONNECT_POINT_NULL);
    return Sets.union(store.getEgressLinks(connectPoint),
                      store.getIngressLinks(connectPoint));
}

        

public AnswerKey copyFallingBackTo(AnswerKey fallback) {
  final Builder ret = modifiedCopyBuilder();

  final ImmutableMap<String, Response> unannotatedHere = Maps.uniqueIndex(unannotatedResponses(),
      ResponseFunctions.uniqueIdentifier());
  final ImmutableMap<String, AssessedResponse> idToAssessedHere =
      Maps.uniqueIndex(annotatedResponses(),
          Functions.compose(ResponseFunctions.uniqueIdentifier(),
              AssessedResponseFunctions.response()));
  final Set<String> idsHere = Sets.union(unannotatedHere.keySet(), idToAssessedHere.keySet());

  final ImmutableMap<String, Response> unannotatedThere = Maps.uniqueIndex(
      fallback.unannotatedResponses(), ResponseFunctions.uniqueIdentifier());
  final ImmutableMap<String, AssessedResponse> idToAssessedThere =
      Maps.uniqueIndex(fallback.annotatedResponses(),
          Functions.compose(ResponseFunctions.uniqueIdentifier(),
              AssessedResponseFunctions.response()));
  final Set<String> idsThere = Sets.union(unannotatedThere.keySet(), idToAssessedThere.keySet());

  final Set<String> idsOnlyInFallback = Sets.difference(idsThere, idsHere);
  for (final String id : idsOnlyInFallback) {
    if (unannotatedThere.containsKey(id)) {
      ret.addUnannotated(unannotatedThere.get(id));
    }
    if (idToAssessedThere.containsKey(id)) {
      final AssessedResponse r = idToAssessedThere.get(id);
      final int CASGroup;
      if (corefAnnotation().CASesToIDs().containsKey(r.response().canonicalArgument())) {
        CASGroup = corefAnnotation().CASesToIDs().get(r.response().canonicalArgument());
      } else {
        CASGroup = fallback.corefAnnotation().CASesToIDs().get(r.response().canonicalArgument());
      }
      ret.addAnnotated(r, CASGroup);
    }
  }
  return ret.build();
}

        

public Set<E> adjacentEdges(E edge) {
  EndpointPair<N> endpointPair = incidentNodes(edge); // Verifies that edge is in this network.
  Set<E> endpointPairIncidentEdges =
      Sets.union(incidentEdges(endpointPair.nodeU()), incidentEdges(endpointPair.nodeV()));
  return Sets.difference(endpointPairIncidentEdges, ImmutableSet.of(edge));
}

        

public static @Nullable Element getUniqueChild(Element parent, String name, Set<String> aliases) throws InvalidXMLException {
    List<Element> children = new ArrayList<>();
    for(String alias : Sets.union(ImmutableSet.of(name), aliases)) {
        children.addAll(parent.getChildren(alias));
    }

    if(children.size() > 1) {
        throw new InvalidXMLException("multiple '" + name + "' tags not allowed", parent);
    }
    return children.isEmpty() ? null : children.get(0);
}        
main