dsmiley commented on code in PR #2846: URL: https://github.com/apache/solr/pull/2846#discussion_r1830301431
########## solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java: ########## @@ -1094,20 +1094,19 @@ private SolrCore checkProps(ZkNodeProps zkProps) { private void getSlicesForCollections( ClusterState clusterState, Collection<Slice> slices, boolean activeSlices) { + if (activeSlices) { - for (Map.Entry<String, DocCollection> entry : clusterState.getCollectionsMap().entrySet()) { - final Slice[] activeCollectionSlices = entry.getValue().getActiveSlicesArr(); - if (activeCollectionSlices != null) { - Collections.addAll(slices, activeCollectionSlices); - } - } + clusterState + .collectionStream() + .map(DocCollection::getActiveSlicesArr) + .filter(Objects::nonNull) + .forEach(them -> Collections.addAll(slices, them)); Review Comment: `slices` would be logical but that's already in-scope; it's an "out" argument. Despite the scope creep, I refactored further to eliminate the argument. I think it's overall clearer. -- 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