Don't write parameter

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1573185 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2014-03-01 15:51:39 +00:00
parent 01329b7cf5
commit b6e5ed0586
1 changed files with 6 additions and 6 deletions

View File

@ -264,13 +264,13 @@ public class EnumUtils {
* @throws IllegalArgumentException if {@code enumClass} is not an enum class * @throws IllegalArgumentException if {@code enumClass} is not an enum class
* @since 3.2 * @since 3.2
*/ */
public static <E extends Enum<E>> EnumSet<E> processBitVectors(final Class<E> enumClass, long... values) { public static <E extends Enum<E>> EnumSet<E> processBitVectors(final Class<E> enumClass, final long... values) {
final EnumSet<E> results = EnumSet.noneOf(asEnum(enumClass)); final EnumSet<E> results = EnumSet.noneOf(asEnum(enumClass));
values = ArrayUtils.clone(Validate.notNull(values)); long[] lvalues = ArrayUtils.clone(Validate.notNull(values));
ArrayUtils.reverse(values); ArrayUtils.reverse(lvalues);
for (final E constant : enumClass.getEnumConstants()) { for (final E constant : enumClass.getEnumConstants()) {
final int block = constant.ordinal() / Long.SIZE; final int block = constant.ordinal() / Long.SIZE;
if (block < values.length && (values[block] & 1 << (constant.ordinal() % Long.SIZE)) != 0) { if (block < lvalues.length && (lvalues[block] & 1 << (constant.ordinal() % Long.SIZE)) != 0) {
results.add(constant); results.add(constant);
} }
} }
@ -288,8 +288,8 @@ public class EnumUtils {
*/ */
private static <E extends Enum<E>> Class<E> checkBitVectorable(final Class<E> enumClass) { private static <E extends Enum<E>> Class<E> checkBitVectorable(final Class<E> enumClass) {
final E[] constants = asEnum(enumClass).getEnumConstants(); final E[] constants = asEnum(enumClass).getEnumConstants();
Validate.isTrue(constants.length <= Long.SIZE, CANNOT_STORE_S_S_VALUES_IN_S_BITS, constants.length, Validate.isTrue(constants.length <= Long.SIZE, CANNOT_STORE_S_S_VALUES_IN_S_BITS,
enumClass.getSimpleName(), Long.SIZE); Integer.valueOf(constants.length), enumClass.getSimpleName(), Integer.valueOf(Long.SIZE));
return enumClass; return enumClass;
} }