dsmiley commented on code in PR #3141: URL: https://github.com/apache/solr/pull/3141#discussion_r1930815270
########## solr/solrj/src/java/org/apache/solr/common/params/SolrParams.java: ########## @@ -526,4 +527,36 @@ public String toString() { } return sb.toString(); } + + /** + * A SolrParams is equal to another if they have the same keys and values. The order of keys does + * not matter. + */ + @Override + public boolean equals(Object obj) { + if (obj == this) return true; + if (!(obj instanceof SolrParams b)) return false; + + // iterating this params, see if other has the same values for each key + int count = 0; + for (Entry<String, String[]> thisEntry : this) { + String name = thisEntry.getKey(); + if (!Arrays.equals(thisEntry.getValue(), b.getParams(name))) return false; + count++; + } + // does other params have the same number of keys? It might have more but not less. + Iterator<String> bNames = b.getParameterNamesIterator(); + while (bNames.hasNext()) { Review Comment: Can you suggest improvements to `testTrivialEquals` to prove your theory? -- 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