risdenk commented on code in PR #1501:
URL: https://github.com/apache/solr/pull/1501#discussion_r1155113686


##########
solr/core/src/java/org/apache/solr/cluster/placement/plugins/MinimizeCoresPlacementFactory.java:
##########
@@ -123,20 +123,23 @@ public List<PlacementPlan> computePlacements(
           // replicas on nodes with less cores first. We only need 
totalReplicasPerShard nodes given
           // that's the number of replicas to place. We assign based on the 
passed
           // nodeEntriesToAssign list so the right nodes get replicas.
-          ArrayList<Map.Entry<Integer, Node>> nodeEntriesToAssign =
+          List<Map.Entry<Integer, Node>> nodeEntriesToAssign =
               new ArrayList<>(totalReplicasPerShard);
-          Iterator<Map.Entry<Integer, Node>> treeIterator = 
nodesByCores.entries().iterator();
+          Iterator<Map.Entry<Integer, Node>> treeIterator =
+              nodesByCores.entrySet().stream()
+                  .flatMap(e -> e.getValue().stream().map(n -> 
Map.entry(e.getKey(), n)))
+                  .iterator();
           for (int i = 0; i < totalReplicasPerShard; i++) {

Review Comment:
   Yes much cleaner - fixed in 983a8306b78c1fa0237eb5661c2a8147a58a6a5d



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to