Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-8433

Add FutureArrays.equals(Object[] a, int aToIndex, Object[] b, int bFromIndex, int bToIndex)

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Trivial
    • Resolution: Won't Fix
    • None
    • None
    • None
    • None
    • New

    Description

      Noticed code like the following in TopFieldCollector:

          if (fields1.length > fields2.length) {
            return false;
          }
          return Arrays.asList(fields1).equals(Arrays.asList(fields2).subList(0, fields1.length));
      

      This can be simplified and made more efficient by using Arrays.equals(Object[] a, int aToIndex, Object[] b, int bFromIndex, int bToIndex) , which is only present in Java 9+. (Though it is not taking advantage of any intrinsics like the primitive arrays do, since it uses object equality rather than reference equality). This can be added as part of FutureArrays.java - this would serve to simplify code.

      Attachments

        Activity

          People

            Unassigned Unassigned
            mbraun688 Michael Braun
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: