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)) ...
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<E> set = new HashSet<>(set1); set.removeAll(set2); return Collections.unmodifiableSet(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 temp = new HashSet(); temp.addAll(a); temp.removeAll(b); return temp;
Set<T> copyOfFirst = new LinkedHashSet<>(first); copyOfFirst.removeAll(second); return copyOfFirst;
Set<T> s3 = new HashSet<T>(s1); s3.removeAll(s2); return s3;
Set<T> difference = new HashSet<T>(setA); difference.removeAll(setB); return difference;