< prev index next >

src/java.base/share/classes/jdk/internal/module/ModuleHashesBuilder.java

Print this page
8200127: Replace collection.stream().forEach() with collection.forEach()
Reviewed-by: alanb

@@ -191,15 +191,14 @@
         /**
          * Returns a transposed graph from this graph.
          */
         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();
         }
 
         /**

@@ -229,12 +228,12 @@
             return visited;
         }
 
         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)));
         }
 
         static class Builder<T> {
             final Set<T> nodes = new HashSet<>();

@@ -300,11 +299,11 @@
                         node + " " + graph.edges().get(node));
                 }
                 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);
         }
     }
< prev index next >