You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "dsmiley (via GitHub)" <gi...@apache.org> on 2023/03/23 01:23:46 UTC

[GitHub] [solr] dsmiley commented on a diff in pull request #1482: SOLR-16715: Replace new HashMap(int) and new HashSet(int) with CollectionUtil.newHashMap / CollectionUtil.newHashSet

dsmiley commented on code in PR #1482:
URL: https://github.com/apache/solr/pull/1482#discussion_r1145571433


##########
solr/core/src/java/org/apache/solr/request/SimpleFacets.java:
##########
@@ -595,7 +595,7 @@ private NamedList<Integer> getTermCounts(String field, Integer mincount, ParsedP
           break;
         case UIF:
           // Emulate the JSON Faceting structure so we can use the same parsing classes
-          Map<String, Object> jsonFacet = new HashMap<>(13);
+          Map<String, Object> jsonFacet = CollectionUtil.newHashMap(13);

Review Comment:
   Could be converted to Map.of if you want (just compute sortVal before).  Don't have to if you don't want to.



##########
solr/core/src/java/org/apache/solr/handler/RequestHandlerUtils.java:
##########
@@ -134,9 +134,7 @@ public static boolean handleRollback(
   public static void setWt(SolrQueryRequest req, String wt) {
     SolrParams params = req.getParams();
     if (params.get(CommonParams.WT) != null) return; // wt is set by user
-    Map<String, String> map = new HashMap<>(1);
-    map.put(CommonParams.WT, wt);
-    map.put("indent", "true");
+    Map<String, String> map = Map.of(CommonParams.WT, wt, "indent", "true");

Review Comment:
   nice :-)



-- 
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-unsubscribe@solr.apache.org

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


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