## org.apache.tools.ant.util
Class CollectionUtils

    java.lang.Object
      org.apache.tools.ant.util.CollectionUtils

    public class CollectionUtils

extends java.lang.Object

A set of helper methods related to collection manipulation.

Since:
  Ant 1.5

Nested Class Summary
`static class` `CollectionUtils.EmptyEnumeration` An empty enumeration.

Field Summary
`static java.util.List` `EMPTY_LIST` Collections.emptyList() is Java5+.

Constructor Summary
`CollectionUtils()`

Method Summary
`static java.util.Enumeration` `append(java.util.Enumeration e1, java.util.Enumeration e2)` Append one enumeration to another.
`static java.util.Collection` `asCollection(java.util.Iterator iter)` Returns a collection containing all elements of the iterator.
`static java.util.Enumeration` `asEnumeration(java.util.Iterator iter)` Adapt the specified Iterator to the Enumeration interface.
`static java.util.Iterator` `asIterator(java.util.Enumeration e)` Adapt the specified Enumeration to the Iterator interface.
`static boolean` `equals(java.util.Dictionary d1, java.util.Dictionary d2)` Deprecated. since 1.6.x.
`static boolean` `equals(java.util.Vector v1, java.util.Vector v2)` Deprecated. since 1.6.x.
`static java.lang.String` `flattenToString(java.util.Collection c)` Creates a comma separated list of all values held in the given collection.
`static int` `frequency(java.util.Collection c, java.lang.Object o)` Counts how often the given Object occurs in the given collection using equals() for comparison.
`static void` `putAll(java.util.Dictionary m1, java.util.Dictionary m2)` Deprecated. since 1.6.x.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### EMPTY_LIST

    public static final java.util.List EMPTY_LIST

  Collections.emptyList() is Java5+.

Constructor Detail

### CollectionUtils

    public CollectionUtils()

Method Detail

### equals

    public static boolean equals(java.util.Vector v1,
                                 java.util.Vector v2)

  Deprecated. since 1.6.x.

  Please use Vector.equals() or List.equals().

  Parameters:
    `v1` - the first vector.
    `v2` - the second vector.
  Returns:
    true if the vectors are equal.
  Since:
    Ant 1.5

### equals

    public static boolean equals(java.util.Dictionary d1,
                                 java.util.Dictionary d2)

  Deprecated. since 1.6.x.

  Dictionary does not have an equals. Please use Map.equals().

  Follows the equals contract of Java 2's Map.

  Parameters:
    `d1` - the first directory.
    `d2` - the second directory.
  Returns:
    true if the directories are equal.
  Since:
    Ant 1.5

### flattenToString

    public static java.lang.String flattenToString(java.util.Collection c)

  Creates a comma separated list of all values held in the given collection.

  Since:
    Ant 1.8.0

### putAll

    public static void putAll(java.util.Dictionary m1,
                              java.util.Dictionary m2)

  Deprecated. since 1.6.x.

  Dictionary does not know the putAll method. Please use Map.putAll().

  Parameters:
    `m1` - the to directory.
    `m2` - the from directory.
  Since:
    Ant 1.6

### append

    public static java.util.Enumeration append(java.util.Enumeration e1,
                                               java.util.Enumeration e2)

  Append one enumeration to another. Elements are evaluated lazily.

  Parameters:
    `e1` - the first enumeration.
    `e2` - the subsequent enumeration.
  Returns:
    an enumeration representing e1 followed by e2.
  Since:
    Ant 1.6.3

### asEnumeration

    public static java.util.Enumeration asEnumeration(java.util.Iterator iter)

  Adapt the specified Iterator to the Enumeration interface.

  Parameters:
    `iter` - the Iterator to adapt.
  Returns:
    an Enumeration.

### asIterator

    public static java.util.Iterator asIterator(java.util.Enumeration e)

  Adapt the specified Enumeration to the Iterator interface.

  Parameters:
    `e` - the Enumeration to adapt.
  Returns:
    an Iterator.

### asCollection

    public static java.util.Collection asCollection(java.util.Iterator iter)

  Returns a collection containing all elements of the iterator.

  Since:
    Ant 1.8.0

### frequency

    public static int frequency(java.util.Collection c,
                                java.lang.Object o)

  Counts how often the given Object occurs in the given collection using equals() for comparison.

  Since:
    Ant 1.8.0