forked from MagicBane/Server
Optimization moved to method
This commit is contained in:
@@ -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