Optimization moved to method
This commit is contained in:
1 parent
aad0418260
commit
dd84615ca1
2 files changed
+7
-4
No files matched your search
@@ -40,6 +40,11 @@ public class Enum {
|
||||
|
||||
EnumSet<E> enumSet = EnumSet.noneOf(enumClass);
|
||||
|
||||
// Early exit if empty set
|
||||
|
||||
if (bitVector == 0)
|
||||
return enumSet;
|
||||
|
||||
for (E enumValue : enumClass.getEnumConstants()) {
|
||||
if ((bitVector & (1L << enumValue.ordinal())) != 0) {
|
||||
enumSet.add(enumValue);
|
||||
|
||||
Reference in new issue
Block a user