public class EnumerationUtils
extends java.lang.Object
Enumeration
instances.Modifier and Type | Method and Description |
---|---|
static <T> T |
get(java.util.Enumeration<T> e,
int index)
Returns the
index -th value in the Enumeration , throwing
IndexOutOfBoundsException if there is no such element. |
static <E> java.util.List<E> |
toList(java.util.Enumeration<? extends E> enumeration)
Creates a list based on an enumeration.
|
static java.util.List<java.lang.String> |
toList(java.util.StringTokenizer stringTokenizer)
Override toList(Enumeration) for StringTokenizer as it implements Enumeration<Object>
for the sake of backward compatibility.
|
public static <T> T get(java.util.Enumeration<T> e, int index)
index
-th value in the Enumeration
, throwing
IndexOutOfBoundsException
if there is no such element.
The Enumeration is advanced to index
(or to the end, if
index
exceeds the number of entries) as a side effect of this method.
T
- the type of object in the Enumeration
e
- the enumeration to get a value fromindex
- the index to getjava.lang.IndexOutOfBoundsException
- if the index is invalidjava.lang.IllegalArgumentException
- if the object type is invalidpublic static <E> java.util.List<E> toList(java.util.Enumeration<? extends E> enumeration)
As the enumeration is traversed, an ArrayList of its values is created. The new list is returned.
E
- the element typeenumeration
- the enumeration to traverse, which should not be null
.java.lang.NullPointerException
- if the enumeration parameter is null
.public static java.util.List<java.lang.String> toList(java.util.StringTokenizer stringTokenizer)
stringTokenizer
- the tokenizer to convert to a List
<String
>"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"