Simplify expressions.

Use final.
Parse to primitive.
This commit is contained in:
Gary Gregory 2021-07-10 09:52:40 -04:00
parent 627a699bd0
commit 929c5f6e68
4 changed files with 6 additions and 6 deletions

View File

@ -425,7 +425,7 @@ public class Streams {
* @since 3.13.0
*/
@SafeVarargs // Creating a stream from an array is safe
public static <T> Stream<T> of(T... values) {
public static <T> Stream<T> of(final T... values) {
return values == null ? Stream.empty() : Stream.of(values);
}

View File

@ -100,7 +100,7 @@ public class RandomUtilsTest {
@Test
public void testBoolean() {
final boolean result = RandomUtils.nextBoolean();
assertTrue(result == true || result == false);
assertTrue(result || !result);
}
/**

View File

@ -84,8 +84,8 @@ public class StreamsTest {
protected <T extends Throwable> FailableConsumer<String, T> asIntConsumer(final T pThrowable) {
return s -> {
final Integer i = Integer.valueOf(s);
if (i.intValue() == 4) {
final int i = Integer.parseInt(s);
if (i == 4) {
throw pThrowable;
}
};

View File

@ -46,8 +46,8 @@ public class StreamsTest {
protected <T extends Throwable> FailableConsumer<String, T> asIntConsumer(final T pThrowable) {
return s -> {
final Integer i = Integer.valueOf(s);
if (i.intValue() == 4) {
final int i = Integer.parseInt(s);
if (i == 4) {
throw pThrowable;
}
};