Top Description Inners Fields Constructors Methods
org.apache.tools.ant.util

public Class CollectionUtils

extends Object
Class Inheritance
Annotations
@Deprecated
Imports
java.util.ArrayList, .Collection, .Collections, .Dictionary, .Enumeration, .Iterator, .List, .NoSuchElementException, .Objects, .Vector, java.util.stream.Collectors

Deprecated

A set of helper methods related to collection manipulation.
Since
Ant 1.5

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
public static class
CollectionUtils.EmptyEnumeration<E>

Deprecated
An empty enumeration.

Field Summary

Modifier and TypeField and Description
public static final List<E>
EMPTY_LIST

Deprecated

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static <
element type
E
>
Enumeration<E>

Returns:

an enumeration representing e1 followed by e2.
append
(Enumeration<E>
the first enumeration.
e1
,
Enumeration<E>
the subsequent enumeration.
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.
public static <
element type
T
>
Collection<T>

Returns:

the collection
asCollection
(final Iterator<? extends T>
the Iterator to convert
iter
)

Deprecated instantiate a list and use forEachRemaining(list::add)
Returns a collection containing all elements of the iterator.
public static <
element type
E
>
Enumeration<E>

Returns:

an Enumeration.
asEnumeration
(final Iterator<E>
the Iterator to adapt.
iter
)

Deprecated use Collections.enumeration()
Adapt the specified Iterator to the Enumeration interface.
public static <
element type
E
>
Iterator<E>

Returns:

an Iterator.
asIterator
(final Enumeration<E>
the Enumeration to adapt.
e
)

Deprecated use Collections.list(e).iterator()
Adapt the specified Enumeration to the Iterator interface.
public static boolean

Returns:

true if the vectors are equal.
equals
(Vector<?>
the first vector.
v1
,
Vector<?>
the second vector.
v2
)

Deprecated since 1.6.x.
Please use Vector.equals() or List.equals().
public static boolean

Returns:

true if the directories are equal.
equals
(Dictionary<?, ?>
the first directory.
d1
,
Dictionary<?, ?>
the second directory.
d2
)

Deprecated since 1.6.x.
Dictionary does not have an equals.
public static String

Returns:

string representation of the collection
flattenToString
(Collection<?>
collection to transform
c
)

Deprecated use stream().collect(Collectors.joining(","))
Creates a comma separated list of all values held in the given collection.
public static int

Returns:

frequency
frequency
(Collection<?>
collection in which to search
c
,
Object
object to search
o
)

Deprecated
Counts how often the given Object occurs in the given collection using equals() for comparison.
public static <
type of the key
K
,
type of the value
V
>
void
putAll(Dictionary<? super K, ? super V>
the to directory.
m1
,
Dictionary<? extends K, ? extends V>
the from directory.
m2
)

Deprecated since 1.6.x.
Dictionary does not know the putAll method.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

EMPTY_LISTback to summary
public static final List<E> EMPTY_LIST

Deprecated

Annotations
@SuppressWarnings:rawtypes
@Deprecated

Constructor Detail

CollectionUtilsback to summary
private CollectionUtils()

Method Detail

appendback to summary
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.

Parameters
<E>
element type
e1:Enumeration<E>

the first enumeration.

e2:Enumeration<E>

the subsequent enumeration.

Returns:Enumeration<E>

an enumeration representing e1 followed by e2.

Annotations
@Deprecated
Since
Ant 1.6.3
asCollectionback to summary
public static <T> Collection<T> asCollection(final Iterator<? extends T> iter)

Deprecated

instantiate a list and use forEachRemaining(list::add)

Returns a collection containing all elements of the iterator.

Parameters
<T>
element type
iter:Iterator<? extends T>

the Iterator to convert

Returns:Collection<T>

the collection

Annotations
@Deprecated
Since
Ant 1.8.0
asEnumerationback to summary
public static <E> Enumeration<E> asEnumeration(final Iterator<E> iter)

Deprecated

use Collections.enumeration()

Adapt the specified Iterator to the Enumeration interface.

Parameters
<E>
element type
iter:Iterator<E>

the Iterator to adapt.

Returns:Enumeration<E>

an Enumeration.

Annotations
@Deprecated
asIteratorback to summary
public static <E> Iterator<E> asIterator(final Enumeration<E> e)

Deprecated

use Collections.list(e).iterator()

Adapt the specified Enumeration to the Iterator interface.

Parameters
<E>
element type
e:Enumeration<E>

the Enumeration to adapt.

Returns:Iterator<E>

an Iterator.

Annotations
@Deprecated
equalsback to summary
public static boolean equals(Vector<?> v1, Vector<?> v2)

Deprecated

since 1.6.x.

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

Parameters
v1:Vector<?>

the first vector.

v2:Vector<?>

the second vector.

Returns:boolean

true if the vectors are equal.

Annotations
@Deprecated
Since
Ant 1.5
equalsback to summary
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:Dictionary<?, ?>

the first directory.

d2:Dictionary<?, ?>

the second directory.

Returns:boolean

true if the directories are equal.

Annotations
@Deprecated
Since
Ant 1.5
flattenToStringback to summary
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<?>

collection to transform

Returns:String

string representation of the collection

Annotations
@Deprecated
Since
Ant 1.8.0
frequencyback to summary
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<?>

collection in which to search

o:Object

object to search

Returns:int

frequency

Annotations
@Deprecated
Since
Ant 1.8.0
putAllback to summary
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().

Parameters
<K>
type of the key
<V>
type of the value
m1:Dictionary<? super K, ? super V>

the to directory.

m2:Dictionary<? extends K, ? extends V>

the from directory.

Annotations
@Deprecated
Since
Ant 1.6
org.apache.tools.ant.util back to summary

private final Class CollectionUtils.CompoundEnumeration<E>

extends Object
implements Enumeration<E>
Class Inheritance
  • java.lang.Object
  • org.apache.tools.ant.util.CollectionUtils.CompoundEnumeration
All Implemented Interfaces
java.util.Enumeration

Field Summary

Modifier and TypeField and Description
private final Enumeration<E>
private final Enumeration<E>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
hasMoreElements()

Implements java.util.Enumeration.hasMoreElements.

Tests if this enumeration contains more elements.
public E
nextElement()

Implements java.util.Enumeration.nextElement.

Returns the next element of this enumeration if this enumeration object has at least one more element to provide.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

e1back to summary
private final Enumeration<E> e1
e2back to summary
private final Enumeration<E> e2

Constructor Detail

CompoundEnumerationback to summary
public CompoundEnumeration(Enumeration<E> e1, Enumeration<E> e2)

Method Detail

hasMoreElementsback to summary
public boolean hasMoreElements()

Implements java.util.Enumeration.hasMoreElements.

Doc from java.util.Enumeration.hasMoreElements.

Tests if this enumeration contains more elements.

Returns:boolean

true if and only if this enumeration object contains at least one more element to provide; false otherwise.

Annotations
@Override
nextElementback to summary
public E nextElement() throws NoSuchElementException

Implements java.util.Enumeration.nextElement.

Doc from java.util.Enumeration.nextElement.

Returns the next element of this enumeration if this enumeration object has at least one more element to provide.

Returns:E

the next element of this enumeration.

Annotations
@Override
Exceptions
NoSuchElementException:
if no more elements exist.
org.apache.tools.ant.util back to summary

public final Class CollectionUtils.EmptyEnumeration<E>

extends Object
implements Enumeration<E>
Class Inheritance
All Implemented Interfaces
java.util.Enumeration
Annotations
@Deprecated

Deprecated

An empty enumeration.
Since
Ant 1.6

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

false always.
hasMoreElements
()

Implements java.util.Enumeration.hasMoreElements.

Tests if this enumeration contains more elements.
public E

Returns:

nothing.
nextElement
()

Implements java.util.Enumeration.nextElement.

Returns the next element of this enumeration if this enumeration object has at least one more element to provide.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

EmptyEnumerationback to summary
public EmptyEnumeration()

Method Detail

hasMoreElementsback to summary
public boolean hasMoreElements()

Implements java.util.Enumeration.hasMoreElements.

Doc from java.util.Enumeration.hasMoreElements.

Tests if this enumeration contains more elements.

Returns:boolean

false always.

Annotations
@Override
nextElementback to summary
public E nextElement() throws NoSuchElementException

Implements java.util.Enumeration.nextElement.

Doc from java.util.Enumeration.nextElement.

Returns the next element of this enumeration if this enumeration object has at least one more element to provide.

Returns:E

nothing.

Annotations
@Override
Exceptions
NoSuchElementException:
always.