diff --git a/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java b/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java index 9140007a6..6c0c10d13 100644 --- a/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java +++ b/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java @@ -35,6 +35,7 @@ import java.util.Map; import java.util.Set; import java.util.TreeMap; import java.util.stream.Collectors; +import java.util.stream.Stream; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ClassUtils; @@ -745,13 +746,13 @@ public class MethodUtils { Validate.notNull(cls, "cls"); Validate.notEmpty(methodName, "methodName"); - final List methods = Arrays.stream(cls.getDeclaredMethods()) + final List methods = Stream.of(cls.getDeclaredMethods()) .filter(method -> method.getName().equals(methodName)) .collect(toList()); ClassUtils.getAllSuperclasses(cls).stream() .map(Class::getDeclaredMethods) - .flatMap(Arrays::stream) + .flatMap(Stream::of) .filter(method -> method.getName().equals(methodName)) .forEach(methods::add); @@ -782,7 +783,7 @@ public class MethodUtils { throw new IllegalStateException( String.format("Found multiple candidates for method %s on class %s : %s", - methodName + Arrays.stream(parameterTypes).map(String::valueOf).collect(Collectors.joining(",", "(", ")")), + methodName + Stream.of(parameterTypes).map(String::valueOf).collect(Collectors.joining(",", "(", ")")), cls.getName(), bestCandidates.stream().map(Method::toString).collect(Collectors.joining(",", "[", "]"))) ); diff --git a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTimeZonesTest.java b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTimeZonesTest.java index 290022922..27bc29036 100644 --- a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTimeZonesTest.java +++ b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTimeZonesTest.java @@ -19,7 +19,6 @@ package org.apache.commons.lang3.time; import static org.junit.jupiter.api.Assertions.assertEquals; import java.text.SimpleDateFormat; -import java.util.Arrays; import java.util.Calendar; import java.util.TimeZone; import java.util.stream.Stream; @@ -32,7 +31,7 @@ public class FastDatePrinterTimeZonesTest { private static final String PATTERN = "h:mma z"; public static Stream data() { - return Arrays.stream(TimeZone.getAvailableIDs()).map(TimeZone::getTimeZone); + return Stream.of(TimeZone.getAvailableIDs()).map(TimeZone::getTimeZone); } @ParameterizedTest