org.apache.tools.ant.types.resources

## Class Union

- java.lang.Object
- - org.apache.tools.ant.ProjectComponent
  - - org.apache.tools.ant.types.DataType
    - - org.apache.tools.ant.types.resources.BaseResourceCollectionContainer
      - - org.apache.tools.ant.types.resources.Union

- All Implemented Interfaces:
    java.lang.Cloneable, java.lang.Iterable<Resource>, ResourceCollection

      public class Union
      extends BaseResourceCollectionContainer

  ResourceCollection representing the union of multiple nested ResourceCollections.
  Since:
    Ant 1.7

- - ### Field Summary

    - ### Fields inherited from class org.apache.tools.ant.types.DataType

      `checked, ref`

    - ### Fields inherited from class org.apache.tools.ant.ProjectComponent

      `description, location, project`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Union()` Default constructor.
    `Union(Project project)` Create a new Union.
    `Union(Project project, ResourceCollection rc)` Convenience constructor.
    `Union(ResourceCollection rc)` Convenience constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected java.util.Set<Resource>` | `getAllResources()` Get the unified set of contained Resources.
    `protected java.util.Collection<java.lang.String>` | `getAllToStrings()` Get a collection of strings representing the unified resource set (strings may duplicate).
    `protected java.util.Collection<Resource>` | `getCollection()` Unify the contained Resources.
    `protected <T> java.util.Collection<T>` | `getCollection(boolean asString)` Deprecated.
    `static Union` | `getInstance(ResourceCollection rc)` Static convenience method to union an arbitrary set of Resources.
    `java.lang.String[]` | `list()` Returns all Resources in String format.
    `Resource[]` | `listResources()` Convenience method.

    - ### Methods inherited from class org.apache.tools.ant.types.resources.BaseResourceCollectionContainer

      `add, addAll, clear, clone, dieOnCircularReference, getResourceCollections, isCache, isFilesystemOnly, iterator, setCache, size, toString`

    - ### Methods inherited from class org.apache.tools.ant.types.DataType

      `checkAttributesAllowed, checkChildrenAllowed, circularReference, dieOnCircularReference, dieOnCircularReference, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getDataTypeName, getRefid, invokeCircularReferenceCheck, isChecked, isReference, noChildrenAllowed, pushAndInvokeCircularReferenceCheck, setChecked, setRefid, tooManyAttributes`

    - ### Methods inherited from class org.apache.tools.ant.ProjectComponent

      `getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Union

          public Union()

      Default constructor.

    - #### Union

          public Union(Project project)

      Create a new Union.
      Parameters:
        `project` - owning Project

    - #### Union

          public Union(ResourceCollection rc)

      Convenience constructor.
      Parameters:
        `rc` - the ResourceCollection to add.

    - #### Union

          public Union(Project project,
               ResourceCollection rc)

      Convenience constructor.
      Parameters:
        `project` - owning Project
        `rc` - the ResourceCollection to add.

  - ### Method Detail

    - #### getInstance

          public static Union getInstance(ResourceCollection rc)

      Static convenience method to union an arbitrary set of Resources.
      Parameters:
        `rc` - a ResourceCollection.
      Returns:
        a Union.

    - #### list

          public java.lang.String[] list()

      Returns all Resources in String format. Provided for convenience in implementing Path.
      Returns:
        String array of Resources.

    - #### listResources

          public Resource[] listResources()

      Convenience method.
      Returns:
        Resource[]

    - #### getCollection

          protected java.util.Collection<Resource> getCollection()

      Unify the contained Resources.
      Specified by:
        `getCollection` in class `BaseResourceCollectionContainer`
      Returns:
        a Collection of Resources.

    - #### getCollection

          @Deprecated
          protected <T> java.util.Collection<T> getCollection(boolean asString)

      Deprecated.
      Unify the contained Resources.
      Parameters:
        `asString` - indicates whether the resulting Collection should contain Strings instead of Resources.
      Returns:
        a Collection of Resources.

    - #### getAllToStrings

          protected java.util.Collection<java.lang.String> getAllToStrings()

      Get a collection of strings representing the unified resource set (strings may duplicate).
      Returns:
        Collection

    - #### getAllResources

          protected java.util.Set<Resource> getAllResources()

      Get the unified set of contained Resources.
      Returns:
        Set