Github user mayya-sharipova commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/320#discussion_r167649286
  
    --- 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 --
    
    @diegoceccarelli thanks for a suggestion. I considered `ArrayList` as well, 
but the code was even more complex. `byNumberTemp` could potentially be a 
sparse array, where some positions don't have values.  You also need to 
`ensureCapacity` of the ArrayList, and `add` null elements. 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to