List of utility methods to do Set Union
Set | union(final Iterable union return new HashSet<T>() { private static final long serialVersionUID = -3161916411604210423L; for (final Set<T> s : elements) { addAll(s); }; ... |
Set | union(final Set union Set<E> set = new HashSet<>(set1); set.addAll(set2); return Collections.unmodifiableSet(set); |
Set | union(final Set union return ((elements.length == 0) ? Collections.<T>emptySet() : new HashSet<T>(elements.length * elements[0].size()) { private static final long serialVersionUID = -3161916411604210423L; for (final Set<T> s : elements) { addAll(s); }); |
Set | union(Set one, Set two) Form a new set that is the union of two IntSets. HashSet n = new HashSet(one.size() + two.size()); Iterator it = one.iterator(); while (it.hasNext()) { n.add(it.next()); it = two.iterator(); while (it.hasNext()) { n.add(it.next()); ... |
Set> | union(Set> a, Set> b) Returns union of a and b as a Hashtable containing all elements in a and b
if (a == null || b == null || a.size() == 0 || b.size() == 0) return Collections.EMPTY_SET; Set<Object> union = new HashSet<Object>((a.size() < b.size()) ? b : a); Set<?> src = (a.size() < b.size()) ? b : a; for (Object o : src) { if (!union.contains(o)) union.add(o); return union; |
Set | union(Set union Set<T> smaller; Set<T> bigger; if (left.size() > right.size()) { bigger = left; smaller = right; } else { bigger = right; smaller = left; ... |
Set | union(Set Union. if (isEmpty(setA) && !isEmpty(setB)) { return Collections.unmodifiableSet(setB); if (!isEmpty(setA) && isEmpty(setB)) { return Collections.unmodifiableSet(setA); if (isEmpty(setA) && isEmpty(setB)) { return new LinkedHashSet<T>(); ... |
Set | union(Set This method finds the union of set A and set B Set<T> union = new HashSet<T>(setA); union.addAll(setB); return union; |
Set | union(Set Returns the union of multiple sets. if (sets == null) return new HashSet<>(); Set<T> result = new HashSet<>(); for (Set<T> s : sets) { if (s != null) result.addAll(s); return result; ... |
String[] | union(String[] set1, String[] set2) Same as union, but for Strings. String[] set = new String[set1.length + set2.length]; System.arraycopy(set1, 0, set, 0, set1.length); System.arraycopy(set2, 0, set, set1.length, set2.length); return (String[]) unique(set); |