Modifier and Type | Class and Description |
---|---|
static class |
Enums.Mask
A utility class that provides functions to encode and decode
enum
instances to and from int or long values, whereby the bits
of the int or long values represent the ordinal numbers of
the enum instances. |
Modifier and Type | Method and Description |
---|---|
static <T extends Enum<T>> |
valueOf(Class<T> type,
List<String> names)
Returns a
List of type <T> containing the results of
Enum.valueOf(Class,String) applied to each of the provided
names . |
static <T extends Enum<T>> |
valueOf(Class<T> type,
String... names)
Returns an array of type
<T> containing the results of
Enum.valueOf(Class,String) applied to each of the provided
names . |
public static <T extends Enum<T>> T[] valueOf(Class<T> type, String... names)
<T>
containing the results of
Enum.valueOf(Class,String)
applied to each of the provided
names
.
All names that do not match a constant in the specified enum class are omitted in the returned array.
Note: This implementation uses a recursive algorithm for optimal
performance, and may fail if the provided names
contains ~8000+
elements.
T
- The type parameter of the specified Enum
.type
- The class for the type <T>
.names
- The string array of names on which to apply
Enum.valueOf(Class,String)
.<T>
containing the results of
Enum.valueOf(Class,String)
applied to each of the provided
names
.IllegalArgumentException
- If the specified class object does not
represent an enum type.NullPointerException
- If type
or names
is null.public static <T extends Enum<T>> T[] valueOf(Class<T> type, List<String> names)
List
of type <T>
containing the results of
Enum.valueOf(Class,String)
applied to each of the provided
names
.
All names that do not match a constant in the specified enum class are omitted in the returned array.
Note: This implementation uses a recursive algorithm for optimal
performance, and may fail if the provided names
contains ~8000+
elements.
T
- The type parameter of the specified Enum
.type
- The class for the type <T>
.names
- The List
of names on which to apply
Enum.valueOf(Class,String)
.List
of type <T>
containing the results of
Enum.valueOf(Class,String)
applied to each of the provided
names
.IllegalArgumentException
- If the specified class object does not
represent an enum type.Copyright © 2020 LibJ. All rights reserved.