List of utility methods to do Set Difference
Set | computeDifference(Set compute Difference Set<String> overlap = new HashSet<String>(); for (Iterator<String> it = a.iterator(); it.hasNext();) { String code = it.next(); if (!exactMatch && code.startsWith(prefix)) if (!b.contains(code)) overlap.add(code); if (exactMatch) if (!b.contains(code)) ... |
Set | diffAbyB(Set A = {1, 2, 3, 4, 5} and B = {3, 4, 5, 6, 7, 8}. if (isEmpty(setA) && !isEmpty(setB)) { return Collections.unmodifiableSet(setB); if (!isEmpty(setA) && isEmpty(setB)) { return Collections.unmodifiableSet(setA); if (isEmpty(setA) && isEmpty(setB)) { return Collections.unmodifiableSet(new LinkedHashSet<T>()); ... |
Set | difference(final Set difference Set<E> set = new HashSet<>(set1); set.removeAll(set2); return Collections.unmodifiableSet(set); |
Set | difference(final Set Returns a set containing all the elements which are not contained by the two given sets. final Set<T> retval = new HashSet<T>(); for (final T e : first) { if (!second.contains(e)) { retval.add(e); for (final T e : second) { if (!first.contains(e)) { ... |
Set | difference(Set a, Set b) difference Set temp = new HashSet(); temp.addAll(a); temp.removeAll(b); return temp; |
Set | difference(Set difference Set<T> copyOfFirst = new LinkedHashSet<>(first); copyOfFirst.removeAll(second); return copyOfFirst; |
Set | difference(Set Return is s1 \ s2 Set<T> s3 = new HashSet<T>(s1); s3.removeAll(s2); return s3; |
Set | difference(Set This method finds the difference between set A and set B i.e. Set<T> difference = new HashSet<T>(setA); difference.removeAll(setB); return difference; |