Simplify enum options creation
Slightly optimizes it
This commit is contained in:
1 parent
8aae23c983
commit
f98c2409be
1 file changed
+1
-1
@@ -216,7 +216,7 @@ public final class ParsedRule<T> implements CarpetRule<T>, Comparable<ParsedRule
|
|||||||
}
|
}
|
||||||
else if (this.type.isEnum())
|
else if (this.type.isEnum())
|
||||||
{
|
{
|
||||||
this.options = Arrays.stream(this.type.getEnumConstants()).map(e -> ((Enum<?>) e).name().toLowerCase(Locale.ROOT)).collect(Collectors.toUnmodifiableList());
|
this.options = Arrays.stream(this.type.getEnumConstants()).map(e -> ((Enum<?>) e).name().toLowerCase(Locale.ROOT)).toList();
|
||||||
converter0 = str -> {
|
converter0 = str -> {
|
||||||
try {
|
try {
|
||||||
@SuppressWarnings({"unchecked", "rawtypes"}) // Raw necessary because of signature. Unchecked because compiler doesn't know T extends Enum
|
@SuppressWarnings({"unchecked", "rawtypes"}) // Raw necessary because of signature. Unchecked because compiler doesn't know T extends Enum
|
||||||
|
|||||||
Reference in new issue
Block a user