This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git


The following commit(s) were added to refs/heads/master by this push:
     new 0c8bc63  Use Stream.of instead of constructing an array as an 
intermediate step
0c8bc63 is described below

commit 0c8bc63ef4c7365bcbfce229881eaed58601f881
Author: Felix Schumacher <[email protected]>
AuthorDate: Thu Aug 22 16:59:49 2019 +0200

    Use Stream.of instead of constructing an array as an intermediate step
---
 src/core/src/main/java/org/apache/jmeter/rmi/AliasKeyManager.java  | 7 ++++---
 .../test/java/org/apache/jmeter/functions/TestStringtoFile.java    | 4 ++--
 .../test/java/org/apache/jorphan/gui/ObjectTableSorterTest.java    | 5 +++--
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/core/src/main/java/org/apache/jmeter/rmi/AliasKeyManager.java 
b/src/core/src/main/java/org/apache/jmeter/rmi/AliasKeyManager.java
index ea22de4..322579e 100644
--- a/src/core/src/main/java/org/apache/jmeter/rmi/AliasKeyManager.java
+++ b/src/core/src/main/java/org/apache/jmeter/rmi/AliasKeyManager.java
@@ -21,7 +21,7 @@ import java.net.Socket;
 import java.security.Principal;
 import java.security.PrivateKey;
 import java.security.cert.X509Certificate;
-import java.util.Arrays;
+import java.util.stream.Stream;
 
 import javax.net.ssl.KeyManager;
 import javax.net.ssl.X509KeyManager;
@@ -56,11 +56,12 @@ public class AliasKeyManager implements X509KeyManager {
      *             if no valid KeyManager is found
      */
     public static AliasKeyManager[] wrap(KeyManager[] kms, String alias) {
-        AliasKeyManager validManager = Arrays.asList(kms).stream()
+        AliasKeyManager validManager = Stream.of(kms)
                 .filter(m -> m instanceof X509KeyManager)
                 .map(m -> (X509KeyManager) m)
                 .filter(m -> m.getPrivateKey(alias) != null)
-                .map(m -> new AliasKeyManager(m, alias)).findFirst()
+                .map(m -> new AliasKeyManager(m, alias))
+                .findFirst()
                 .orElseThrow(() -> new IllegalArgumentException(
                         "No key found for alias '" + alias + "'"));
         return new AliasKeyManager[] { validManager };
diff --git 
a/src/functions/src/test/java/org/apache/jmeter/functions/TestStringtoFile.java 
b/src/functions/src/test/java/org/apache/jmeter/functions/TestStringtoFile.java
index 3732c56..c811a32 100644
--- 
a/src/functions/src/test/java/org/apache/jmeter/functions/TestStringtoFile.java
+++ 
b/src/functions/src/test/java/org/apache/jmeter/functions/TestStringtoFile.java
@@ -21,9 +21,9 @@ import java.io.File;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Paths;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.jmeter.engine.util.CompoundVariable;
@@ -192,7 +192,7 @@ public class TestStringtoFile extends JMeterTestCase {
     }
 
     private Collection<CompoundVariable> functionParams(String... args) {
-        return 
Arrays.asList(args).stream().map(CompoundVariable::new).collect(Collectors.toList());
+        return 
Stream.of(args).map(CompoundVariable::new).collect(Collectors.toList());
     }
 
     @Test
diff --git 
a/src/jorphan/src/test/java/org/apache/jorphan/gui/ObjectTableSorterTest.java 
b/src/jorphan/src/test/java/org/apache/jorphan/gui/ObjectTableSorterTest.java
index b94243e..4c2fe13 100644
--- 
a/src/jorphan/src/test/java/org/apache/jorphan/gui/ObjectTableSorterTest.java
+++ 
b/src/jorphan/src/test/java/org/apache/jorphan/gui/ObjectTableSorterTest.java
@@ -41,6 +41,7 @@ import java.util.List;
 import java.util.Map.Entry;
 import java.util.stream.Collectors;
 import java.util.stream.IntStream;
+import java.util.stream.Stream;
 
 import javax.swing.RowSorter.SortKey;
 import javax.swing.SortOrder;
@@ -139,8 +140,8 @@ public class ObjectTableSorterTest {
 
     @Test
     public void customKeyOrder() {
-        HashMap<String, Integer> customKeyOrder = asList("a", "c", "b", "d")
-                .stream().reduce(new HashMap<String, Integer>(), (map, key) -> 
{
+        HashMap<String, Integer> customKeyOrder = Stream.of("a", "c", "b", "d")
+                .reduce(new HashMap<String, Integer>(), (map, key) -> {
                     map.put(key, map.size());
                     return map;
                 }, (a, b) -> a);

Reply via email to