In-line some single use local variables.

This commit is contained in:
Gary Gregory 2021-12-08 10:11:58 -05:00
parent 4e9ca082a6
commit d672dafa2e
1 changed files with 3 additions and 6 deletions

View File

@ -122,8 +122,7 @@ public class BooleanUtils {
public static Boolean and(final Boolean... array) { public static Boolean and(final Boolean... array) {
ObjectUtils.requireNonEmpty(array, "array"); ObjectUtils.requireNonEmpty(array, "array");
try { try {
final boolean[] primitive = ArrayUtils.toPrimitive(array); return and(ArrayUtils.toPrimitive(array)) ? Boolean.TRUE : Boolean.FALSE;
return and(primitive) ? Boolean.TRUE : Boolean.FALSE;
} catch (final NullPointerException ex) { } catch (final NullPointerException ex) {
throw new IllegalArgumentException("The array must not contain any null elements"); throw new IllegalArgumentException("The array must not contain any null elements");
} }
@ -301,8 +300,7 @@ public class BooleanUtils {
public static Boolean or(final Boolean... array) { public static Boolean or(final Boolean... array) {
ObjectUtils.requireNonEmpty(array, "array"); ObjectUtils.requireNonEmpty(array, "array");
try { try {
final boolean[] primitive = ArrayUtils.toPrimitive(array); return or(ArrayUtils.toPrimitive(array)) ? Boolean.TRUE : Boolean.FALSE;
return or(primitive) ? Boolean.TRUE : Boolean.FALSE;
} catch (final NullPointerException ex) { } catch (final NullPointerException ex) {
throw new IllegalArgumentException("The array must not contain any null elements"); throw new IllegalArgumentException("The array must not contain any null elements");
} }
@ -1122,8 +1120,7 @@ public class BooleanUtils {
public static Boolean xor(final Boolean... array) { public static Boolean xor(final Boolean... array) {
ObjectUtils.requireNonEmpty(array, "array"); ObjectUtils.requireNonEmpty(array, "array");
try { try {
final boolean[] primitive = ArrayUtils.toPrimitive(array); return xor(ArrayUtils.toPrimitive(array)) ? Boolean.TRUE : Boolean.FALSE;
return xor(primitive) ? Boolean.TRUE : Boolean.FALSE;
} catch (final NullPointerException ex) { } catch (final NullPointerException ex) {
throw new IllegalArgumentException("The array must not contain any null elements"); throw new IllegalArgumentException("The array must not contain any null elements");
} }