FileDocCategorySizeDatePackage
Difference.javaAPI DocApache Ant 1.702307Wed Dec 13 06:16:20 GMT 2006org.apache.tools.ant.types.resources

Difference

public class Difference extends BaseResourceCollectionContainer
ResourceCollection representing the difference between two or more nested ResourceCollections.
since
Ant 1.7

Fields Summary
Constructors Summary
Methods Summary
protected java.util.CollectiongetCollection()
Calculate the difference of the nested ResourceCollections.

return
a Collection of Resources.

        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;
    
private static org.apache.tools.ant.types.ResourceCollectionnextRC(java.util.Iterator i)

        return (ResourceCollection) i.next();