Calculate the difference of the nested ResourceCollections.
List rc = getResourceCollections();
int size = rc.size();
if (size < 2) {
throw new BuildException("The difference of " + size
+ " resource collection" + ((size == 1) ? "" : "s")
+ " is undefined.");
}
HashSet hs = new HashSet();
ArrayList al = new ArrayList();
for (Iterator rcIter = rc.iterator(); rcIter.hasNext();) {
for (Iterator r = nextRC(rcIter).iterator(); r.hasNext();) {
Object next = r.next();
if (hs.add(next)) {
al.add(next);
} else {
al.remove(next);
}
}
}
return al;