public final class Enumerations extends Object
Enumeration
.Modifier and Type | Method and Description |
---|---|
static <T> Enumeration<T> |
singleton(T o)
Returns an
Enumeration containing only the specified object. |
static <T> T[] |
toArray(Class<T> componentType,
Enumeration<? extends T> enumeration)
Returns an array of type
<T> containing the object references in
the specified Enumeration . |
static <T> List<T> |
toList(Class<T> componentType,
Enumeration<? extends T> enumeration)
|
public static <T> T[] toArray(Class<T> componentType, Enumeration<? extends T> enumeration)
<T>
containing the object references in
the specified Enumeration
.
Note: This implementation uses a recursive algorithm for optimal
performance, and may fail if the specified Enumeration
contains
~8000+ elements.
T
- The type parameter of the specified Class
and
Enumeration
.componentType
- The class for the type <T>
.enumeration
- The Enumeration
.T
containing the object references in the
specified Enumeration
.public static <T> List<T> toList(Class<T> componentType, Enumeration<? extends T> enumeration)
List
of type <T>
containing the object references
in the specified Enumeration
.
Note: This implementation uses a recursive algorithm for optimal
performance, and may fail if the specified Enumeration
contains
~8000+ elements.
T
- The type parameter of the specified Class
and
Enumeration
.componentType
- The class for the type <T>
.enumeration
- The Enumeration
.List
of type T
containing the object references
in the specified Enumeration
.public static <T> Enumeration<T> singleton(T o)
Enumeration
containing only the specified object.T
- The type of the object in the Enumeration
.o
- The sole object to be stored in the returned set.Enumeration
containing only the specified object.Copyright © 2020 LibJ. All rights reserved.