Java Collection Union union(Collection set1, Collection set2)

Here you can find the source of union(Collection set1, Collection set2)

Description

union

License

Open Source License

Declaration

public static <T> Collection<T> union(Collection<T> set1, Collection<T> set2) 

Method Source Code

//package com.java2s;

import java.util.*;

public class Main {
    public static <T> Collection<T> union(Collection<T> set1, Collection<T> set2) {
        Collection<T> union = new ArrayList<>();
        for (T t : set1) {
            union.add(t);//from www  .  jav a  2  s.co  m
        }
        for (T t : set2) {
            union.add(t);
        }
        return union;
    }
}

Related

  1. union(Collection> sets)
  2. union(Collection a, Collection b)
  3. union(Collection c1, Collection c2)
  4. union(Collection initial, Collection other)
  5. union(Collection lhs, Collection rhs)
  6. union(final Collection a, final Collection b)
  7. union(final Collection c1, final Collection c2)
  8. union(final Collection... sets)
  9. union(final Collection a, final Collection b)