Package org.apache.tools.ant.util

# Class CollectionUtils

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

@Deprecated public class CollectionUtils extends Object
Deprecated.
A set of helper methods related to collection manipulation.

Since:
  Ant 1.5

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static final class`
  `CollectionUtils.EmptyEnumeration<E>`
  Deprecated.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final List`
  `EMPTY_LIST`
  Deprecated.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static <E> Enumeration<E>`
  `append(Enumeration<E> e1, Enumeration<E> e2)`
  Deprecated.
  use Stream.concat(Collections.list(e1).stream(), Collections.list(e2).stream()) .collect(Collectors.collectingAndThen(Collectors.toList(), Collections::enumeration))
  `static <T> Collection<T>`
  `asCollection(Iterator<? extends T> iter)`
  Deprecated.
  instantiate a list and use forEachRemaining(list::add)
  `static <E> Enumeration<E>`
  `asEnumeration(Iterator<E> iter)`
  Deprecated.
  use Collections.enumeration()
  `static <E> Iterator<E>`
  `asIterator(Enumeration<E> e)`
  Deprecated.
  use Collections.list(e).iterator()
  `static boolean`
  `equals(Dictionary<?,?> d1, Dictionary<?,?> d2)`
  Deprecated.
  since 1.6.x.
  `static boolean`
  `equals(Vector<?> v1, Vector<?> v2)`
  Deprecated.
  since 1.6.x.
  `static String`
  `flattenToString(Collection<?> c)`
  Deprecated.
  use stream().collect(Collectors.joining(","))
  `static int`
  `frequency(Collection<?> c, Object o)`
  Deprecated.
  `static <K, V> void`
  `putAll(Dictionary<? super K,? super V> m1, Dictionary<? extends K,? extends V> 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 Details

  - ### EMPTY_LIST

    @Deprecated public static final List EMPTY_LIST
    Deprecated.

- ## Method Details

  - ### equals

    @Deprecated public static boolean equals(Vector<?> v1, 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

    @Deprecated public static boolean equals(Dictionary<?,?> d1, 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

    @Deprecated public static String flattenToString(Collection<?> c)
    Deprecated.
    use stream().collect(Collectors.joining(","))
    Creates a comma separated list of all values held in the given collection.
    Parameters:
      `c` - collection to transform
    Returns:
      string representation of the collection
    Since:
      Ant 1.8.0

  - ### putAll

    @Deprecated public static <K, V> void putAll(Dictionary<? super K,? super V> m1, Dictionary<? extends K,? extends V> m2)
    Deprecated.
    since 1.6.x.
    Dictionary does not know the putAll method. Please use Map.putAll().
    Type Parameters:
      `K` - type of the key
      `V` - type of the value
    Parameters:
      `m1` - the to directory.
      `m2` - the from directory.
    Since:
      Ant 1.6

  - ### append

    @Deprecated public static <E> Enumeration<E> append(Enumeration<E> e1, Enumeration<E> e2)
    Deprecated.
    use Stream.concat(Collections.list(e1).stream(), Collections.list(e2).stream()) .collect(Collectors.collectingAndThen(Collectors.toList(), Collections::enumeration))
    Append one enumeration to another. Elements are evaluated lazily.
    Type Parameters:
      `E` - element type
    Parameters:
      `e1` - the first enumeration.
      `e2` - the subsequent enumeration.
    Returns:
      an enumeration representing e1 followed by e2.
    Since:
      Ant 1.6.3

  - ### asEnumeration

    @Deprecated public static <E> Enumeration<E> asEnumeration(Iterator<E> iter)
    Deprecated.
    use Collections.enumeration()
    Adapt the specified Iterator to the Enumeration interface.
    Type Parameters:
      `E` - element type
    Parameters:
      `iter` - the Iterator to adapt.
    Returns:
      an Enumeration.

  - ### asIterator

    @Deprecated public static <E> Iterator<E> asIterator(Enumeration<E> e)
    Deprecated.
    use Collections.list(e).iterator()
    Adapt the specified Enumeration to the Iterator interface.
    Type Parameters:
      `E` - element type
    Parameters:
      `e` - the Enumeration to adapt.
    Returns:
      an Iterator.

  - ### asCollection

    @Deprecated public static <T> Collection<T> asCollection(Iterator<? extends T> iter)
    Deprecated.
    instantiate a list and use forEachRemaining(list::add)
    Returns a collection containing all elements of the iterator.
    Type Parameters:
      `T` - element type
    Parameters:
      `iter` - the Iterator to convert
    Returns:
      the collection
    Since:
      Ant 1.8.0

  - ### frequency

    @Deprecated public static int frequency(Collection<?> c, Object o)
    Deprecated.
    Counts how often the given Object occurs in the given collection using equals() for comparison.
    Parameters:
      `c` - collection in which to search
      `o` - object to search
    Returns:
      frequency
    Since:
      Ant 1.8.0