/** Return the difference of two sets, a - b. */ <T> Set<T> diff(Set<T> a, Set<T> b) { if (b.isEmpty()) return a; Set<T> result = new LinkedHashSet<T>(a); result.removeAll(b); return result; }