8200127: Replace collection.stream().forEach() with collection.forEach()
authormartin
Thu, 05 Apr 2018 09:34:46 -0700
changeset 49529 c0bdb1b1ab4f
parent 49528 c1eb35eb5f38
child 49530 8f2ceebdc673
8200127: Replace collection.stream().forEach() with collection.forEach() Reviewed-by: alanb
src/java.base/share/classes/java/lang/module/ModuleDescriptor.java
src/java.base/share/classes/java/lang/reflect/Proxy.java
src/java.base/share/classes/jdk/internal/module/ModuleHashesBuilder.java
--- a/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java	Thu Apr 05 09:33:27 2018 -0700
+++ b/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java	Thu Apr 05 09:34:46 2018 -0700
@@ -1742,7 +1742,7 @@
                 throw new IllegalArgumentException("Empty target set");
             if (strict) {
                 requirePackageName(e.source());
-                targets.stream().forEach(Checks::requireModuleName);
+                targets.forEach(Checks::requireModuleName);
             }
             return exports(e);
         }
@@ -1878,7 +1878,7 @@
                 throw new IllegalArgumentException("Empty target set");
             if (strict) {
                 requirePackageName(opens.source());
-                targets.stream().forEach(Checks::requireModuleName);
+                targets.forEach(Checks::requireModuleName);
             }
             return opens(opens);
         }
--- a/src/java.base/share/classes/java/lang/reflect/Proxy.java	Thu Apr 05 09:33:27 2018 -0700
+++ b/src/java.base/share/classes/java/lang/reflect/Proxy.java	Thu Apr 05 09:34:46 2018 -0700
@@ -593,8 +593,7 @@
                                   module.getName(), cn, loader);
             }
             if (isDebug("debug")) {
-                interfaces.stream()
-                          .forEach(c -> System.out.println(toDetails(c)));
+                interfaces.forEach(c -> System.out.println(toDetails(c)));
             }
         }
 
--- a/src/java.base/share/classes/jdk/internal/module/ModuleHashesBuilder.java	Thu Apr 05 09:33:27 2018 -0700
+++ b/src/java.base/share/classes/jdk/internal/module/ModuleHashesBuilder.java	Thu Apr 05 09:34:46 2018 -0700
@@ -193,11 +193,10 @@
          */
         public Graph<T> transpose() {
             Builder<T> builder = new Builder<>();
-            nodes.stream().forEach(builder::addNode);
+            nodes.forEach(builder::addNode);
             // reverse edges
             edges.keySet().forEach(u -> {
-                edges.get(u).stream()
-                    .forEach(v -> builder.addEdge(v, u));
+                edges.get(u).forEach(v -> builder.addEdge(v, u));
             });
             return builder.build();
         }
@@ -231,8 +230,8 @@
 
         public void printGraph(PrintStream out) {
             out.println("graph for " + nodes);
-            nodes.stream()
-                .forEach(u -> adjacentNodes(u).stream()
+            nodes
+                .forEach(u -> adjacentNodes(u)
                     .forEach(v -> out.format("  %s -> %s%n", u, v)));
         }
 
@@ -302,7 +301,7 @@
                 return;
             }
             visited.add(node);
-            graph.edges().get(node).stream()
+            graph.edges().get(node)
                 .forEach(x -> visit(x, visited, done));
             done.add(node);
             result.addLast(node);