Github user diegoceccarelli commented on a diff in the pull request: https://github.com/apache/lucene-solr/pull/320#discussion_r167671548 --- Diff: lucene/core/src/java/org/apache/lucene/index/FieldInfos.java --- @@ -63,21 +62,30 @@ public FieldInfos(FieldInfo[] infos) { boolean hasNorms = false; boolean hasDocValues = false; boolean hasPointValues = false; - - TreeMap<Integer, FieldInfo> byNumber = new TreeMap<>(); + + int size = 0; // number of elements in byNumberTemp + int capacity = 10; // byNumberTemp's capacity + FieldInfo[] byNumberTemp = new FieldInfo[capacity]; --- End diff -- That's true :) what about having an `ArrayList` and then a separate private method `ensureSize` ? ``` private static void ensureSize(ArrayList<?> list, int size) { list.ensureCapacity(size); while (list.size() < size) { list.add(null); } } ``` In this way you will not have to care about the logic behind the resizing and you will have less variables around.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org