serhiy-bzhezytskyy commented on code in PR #4760:
URL: https://github.com/apache/solr/pull/4760#discussion_r3822867265
##########
solr/solrj/src/java/org/apache/solr/common/cloud/DocCollection.java:
##########
@@ -400,13 +401,9 @@ public Iterator<Slice> iterator() {
return slices.values().iterator();
}
- @Deprecated // low usage and builds an ArrayList (surprising)
- public List<Replica> getReplicas() {
- List<Replica> replicas = new ArrayList<>();
- for (Slice slice : this) {
- replicas.addAll(slice.getReplicas());
- }
- return replicas;
+ /** Stream of all replicas across all slices. */
+ public Stream<Replica> getReplicaStream() {
Review Comment:
:) i think it is obvious that it smells now ...
look at this one: getReplicaStream().filter(...).findFirst().orElse(null).
it doesn't look fluently (aka Fluent API), right? so i think it should be
replicaStream().filter(...).findFirst().orElse(null). etc
@dsmiley if it does make sense for you/us then i will be happy (not AI term)
to make such refactoring not only here but we i will feel the same smell
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]