You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2021/09/21 08:47:55 UTC

[GitHub] [lucene] jpountz commented on a change in pull request #311: LUCENE-10097: Replace TreeMap use by HashMap when unnecessary

jpountz commented on a change in pull request #311:
URL: https://github.com/apache/lucene/pull/311#discussion_r712832329



##########
File path: lucene/core/src/java/org/apache/lucene/codecs/perfield/PerFieldPostingsFormat.java
##########
@@ -340,9 +342,15 @@ public FieldsReader(final SegmentReadState readState) throws IOException {
       this.segment = readState.segmentInfo.name;
     }
 
+    private static List<String> buildFieldList(Map<String, FieldsProducer> fields) {
+      List<String> fieldList = new ArrayList<>(fields.keySet());
+      fieldList.sort(null);
+      return Collections.unmodifiableList(fieldList);
+    }

Review comment:
       nit: `buildFieldList` is a bit abstract and if I was reading a call site of this method I'd need to look at its definition to understand what it does exactly. Maybe call it `createSortedCopy(Collection<String>)` instead and fix call sites to pass the keyset to make the code easier to read?




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

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



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