< prev index next >

src/java.base/share/classes/java/util/Arrays.java

Print this page
rev 58428 : [mq]: XXXXXXX-typos


2777         int bLength = bToIndex - bFromIndex;
2778         if (aLength != bLength)
2779             return false;
2780 
2781         return ArraysSupport.mismatch(a, aFromIndex,
2782                                       b, bFromIndex,
2783                                       aLength) < 0;
2784     }
2785 
2786     /**
2787      * Returns {@code true} if the two specified arrays of doubles are
2788      * <i>equal</i> to one another.  Two arrays are considered equal if both
2789      * arrays contain the same number of elements, and all corresponding pairs
2790      * of elements in the two arrays are equal.  In other words, two arrays
2791      * are equal if they contain the same elements in the same order.  Also,
2792      * two array references are considered equal if both are {@code null}.
2793      *
2794      * Two doubles {@code d1} and {@code d2} are considered equal if:
2795      * <pre>    {@code new Double(d1).equals(new Double(d2))}</pre>
2796      * (Unlike the {@code ==} operator, this method considers
2797      * {@code NaN} equals to itself, and 0.0d unequal to -0.0d.)
2798      *
2799      * @param a one array to be tested for equality
2800      * @param a2 the other array to be tested for equality
2801      * @return {@code true} if the two arrays are equal
2802      * @see Double#equals(Object)
2803      */
2804     public static boolean equals(double[] a, double[] a2) {
2805         if (a==a2)
2806             return true;
2807         if (a==null || a2==null)
2808             return false;
2809 
2810         int length = a.length;
2811         if (a2.length != length)
2812             return false;
2813 
2814         return ArraysSupport.mismatch(a, a2, length) < 0;
2815     }
2816 
2817     /**
2818      * Returns true if the two specified arrays of doubles, over the specified
2819      * ranges, are <i>equal</i> to one another.
2820      *
2821      * <p>Two arrays are considered equal if the number of elements covered by
2822      * each range is the same, and all corresponding pairs of elements over the
2823      * specified ranges in the two arrays are equal.  In other words, two arrays
2824      * are equal if they contain, over the specified ranges, the same elements
2825      * in the same order.
2826      *
2827      * <p>Two doubles {@code d1} and {@code d2} are considered equal if:
2828      * <pre>    {@code new Double(d1).equals(new Double(d2))}</pre>
2829      * (Unlike the {@code ==} operator, this method considers
2830      * {@code NaN} equals to itself, and 0.0d unequal to -0.0d.)
2831      *
2832      * @param a the first array to be tested for equality
2833      * @param aFromIndex the index (inclusive) of the first element in the
2834      *                   first array to be tested
2835      * @param aToIndex the index (exclusive) of the last element in the
2836      *                 first array to be tested
2837      * @param b the second array to be tested for equality
2838      * @param bFromIndex the index (inclusive) of the first element in the
2839      *                   second array to be tested
2840      * @param bToIndex the index (exclusive) of the last element in the
2841      *                 second array to be tested
2842      * @return {@code true} if the two arrays, over the specified ranges, are
2843      *         equal
2844      * @throws IllegalArgumentException
2845      *         if {@code aFromIndex > aToIndex} or
2846      *         if {@code bFromIndex > bToIndex}
2847      * @throws ArrayIndexOutOfBoundsException
2848      *         if {@code aFromIndex < 0 or aToIndex > a.length} or
2849      *         if {@code bFromIndex < 0 or bToIndex > b.length}
2850      * @throws NullPointerException


2860         int aLength = aToIndex - aFromIndex;
2861         int bLength = bToIndex - bFromIndex;
2862         if (aLength != bLength)
2863             return false;
2864 
2865         return ArraysSupport.mismatch(a, aFromIndex,
2866                                       b, bFromIndex, aLength) < 0;
2867     }
2868 
2869     /**
2870      * Returns {@code true} if the two specified arrays of floats are
2871      * <i>equal</i> to one another.  Two arrays are considered equal if both
2872      * arrays contain the same number of elements, and all corresponding pairs
2873      * of elements in the two arrays are equal.  In other words, two arrays
2874      * are equal if they contain the same elements in the same order.  Also,
2875      * two array references are considered equal if both are {@code null}.
2876      *
2877      * Two floats {@code f1} and {@code f2} are considered equal if:
2878      * <pre>    {@code new Float(f1).equals(new Float(f2))}</pre>
2879      * (Unlike the {@code ==} operator, this method considers
2880      * {@code NaN} equals to itself, and 0.0f unequal to -0.0f.)
2881      *
2882      * @param a one array to be tested for equality
2883      * @param a2 the other array to be tested for equality
2884      * @return {@code true} if the two arrays are equal
2885      * @see Float#equals(Object)
2886      */
2887     public static boolean equals(float[] a, float[] a2) {
2888         if (a==a2)
2889             return true;
2890         if (a==null || a2==null)
2891             return false;
2892 
2893         int length = a.length;
2894         if (a2.length != length)
2895             return false;
2896 
2897         return ArraysSupport.mismatch(a, a2, length) < 0;
2898     }
2899 
2900     /**
2901      * Returns true if the two specified arrays of floats, over the specified
2902      * ranges, are <i>equal</i> to one another.
2903      *
2904      * <p>Two arrays are considered equal if the number of elements covered by
2905      * each range is the same, and all corresponding pairs of elements over the
2906      * specified ranges in the two arrays are equal.  In other words, two arrays
2907      * are equal if they contain, over the specified ranges, the same elements
2908      * in the same order.
2909      *
2910      * <p>Two floats {@code f1} and {@code f2} are considered equal if:
2911      * <pre>    {@code new Float(f1).equals(new Float(f2))}</pre>
2912      * (Unlike the {@code ==} operator, this method considers
2913      * {@code NaN} equals to itself, and 0.0f unequal to -0.0f.)
2914      *
2915      * @param a the first array to be tested for equality
2916      * @param aFromIndex the index (inclusive) of the first element in the
2917      *                   first array to be tested
2918      * @param aToIndex the index (exclusive) of the last element in the
2919      *                 first array to be tested
2920      * @param b the second array to be tested for equality
2921      * @param bFromIndex the index (inclusive) of the first element in the
2922      *                   second array to be tested
2923      * @param bToIndex the index (exclusive) of the last element in the
2924      *                 second array to be tested
2925      * @return {@code true} if the two arrays, over the specified ranges, are
2926      *         equal
2927      * @throws IllegalArgumentException
2928      *         if {@code aFromIndex > aToIndex} or
2929      *         if {@code bFromIndex > bToIndex}
2930      * @throws ArrayIndexOutOfBoundsException
2931      *         if {@code aFromIndex < 0 or aToIndex > a.length} or
2932      *         if {@code bFromIndex < 0 or bToIndex > b.length}
2933      * @throws NullPointerException


7476      * it follows that the relative index is only valid for the array with the
7477      * larger range.
7478      * Otherwise, there is no mismatch.
7479      *
7480      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
7481      * ranges [{@code aFromIndex}, {@code atoIndex}) and
7482      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
7483      * prefix of length {@code pl} if the following expression is true:
7484      * <pre>{@code
7485      *     pl >= 0 &&
7486      *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
7487      *     Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
7488      *     a[aFromIndex + pl] != b[bFromIndex + pl]
7489      * }</pre>
7490      * Note that a common prefix length of {@code 0} indicates that the first
7491      * elements from each array mismatch.
7492      *
7493      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
7494      * ranges [{@code aFromIndex}, {@code atoIndex}) and
7495      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
7496      * if the following expression is true:
7497      * <pre>{@code
7498      *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
7499      *     Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
7500      *                   b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
7501      * }</pre>
7502      *
7503      * @param a the first array to be tested for a mismatch
7504      * @param aFromIndex the index (inclusive) of the first element in the
7505      *                   first array to be tested
7506      * @param aToIndex the index (exclusive) of the last element in the
7507      *                 first array to be tested
7508      * @param b the second array to be tested for a mismatch
7509      * @param bFromIndex the index (inclusive) of the first element in the
7510      *                   second array to be tested
7511      * @param bToIndex the index (exclusive) of the last element in the
7512      *                 second array to be tested
7513      * @return the relative index of the first mismatch between the two arrays
7514      *         over the specified ranges, otherwise {@code -1}.
7515      * @throws IllegalArgumentException
7516      *         if {@code aFromIndex > aToIndex} or


7603      * it follows that the relative index is only valid for the array with the
7604      * larger range.
7605      * Otherwise, there is no mismatch.
7606      *
7607      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
7608      * ranges [{@code aFromIndex}, {@code atoIndex}) and
7609      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
7610      * prefix of length {@code pl} if the following expression is true:
7611      * <pre>{@code
7612      *     pl >= 0 &&
7613      *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
7614      *     Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
7615      *     a[aFromIndex + pl] != b[bFromIndex + pl]
7616      * }</pre>
7617      * Note that a common prefix length of {@code 0} indicates that the first
7618      * elements from each array mismatch.
7619      *
7620      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
7621      * ranges [{@code aFromIndex}, {@code atoIndex}) and
7622      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
7623      * if the following expression is true:
7624      * <pre>{@code
7625      *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
7626      *     Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
7627      *                   b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
7628      * }</pre>
7629      *
7630      * @param a the first array to be tested for a mismatch
7631      * @param aFromIndex the index (inclusive) of the first element in the
7632      *                   first array to be tested
7633      * @param aToIndex the index (exclusive) of the last element in the
7634      *                 first array to be tested
7635      * @param b the second array to be tested for a mismatch
7636      * @param bFromIndex the index (inclusive) of the first element in the
7637      *                   second array to be tested
7638      * @param bToIndex the index (exclusive) of the last element in the
7639      *                 second array to be tested
7640      * @return the relative index of the first mismatch between the two arrays
7641      *         over the specified ranges, otherwise {@code -1}.
7642      * @throws IllegalArgumentException
7643      *         if {@code aFromIndex > aToIndex} or


7730      * it follows that the relative index is only valid for the array with the
7731      * larger range.
7732      * Otherwise, there is no mismatch.
7733      *
7734      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
7735      * ranges [{@code aFromIndex}, {@code atoIndex}) and
7736      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
7737      * prefix of length {@code pl} if the following expression is true:
7738      * <pre>{@code
7739      *     pl >= 0 &&
7740      *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
7741      *     Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
7742      *     a[aFromIndex + pl] != b[bFromIndex + pl]
7743      * }</pre>
7744      * Note that a common prefix length of {@code 0} indicates that the first
7745      * elements from each array mismatch.
7746      *
7747      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
7748      * ranges [{@code aFromIndex}, {@code atoIndex}) and
7749      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
7750      * if the following expression is true:
7751      * <pre>{@code
7752      *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
7753      *     Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
7754      *                   b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
7755      * }</pre>
7756      *
7757      * @param a the first array to be tested for a mismatch
7758      * @param aFromIndex the index (inclusive) of the first element in the
7759      *                   first array to be tested
7760      * @param aToIndex the index (exclusive) of the last element in the
7761      *                 first array to be tested
7762      * @param b the second array to be tested for a mismatch
7763      * @param bFromIndex the index (inclusive) of the first element in the
7764      *                   second array to be tested
7765      * @param bToIndex the index (exclusive) of the last element in the
7766      *                 second array to be tested
7767      * @return the relative index of the first mismatch between the two arrays
7768      *         over the specified ranges, otherwise {@code -1}.
7769      * @throws IllegalArgumentException
7770      *         if {@code aFromIndex > aToIndex} or


7857      * it follows that the relative index is only valid for the array with the
7858      * larger range.
7859      * Otherwise, there is no mismatch.
7860      *
7861      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
7862      * ranges [{@code aFromIndex}, {@code atoIndex}) and
7863      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
7864      * prefix of length {@code pl} if the following expression is true:
7865      * <pre>{@code
7866      *     pl >= 0 &&
7867      *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
7868      *     Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
7869      *     a[aFromIndex + pl] != b[bFromIndex + pl]
7870      * }</pre>
7871      * Note that a common prefix length of {@code 0} indicates that the first
7872      * elements from each array mismatch.
7873      *
7874      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
7875      * ranges [{@code aFromIndex}, {@code atoIndex}) and
7876      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
7877      * if the following expression is true:
7878      * <pre>{@code
7879      *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
7880      *     Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
7881      *                   b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
7882      * }</pre>
7883      *
7884      * @param a the first array to be tested for a mismatch
7885      * @param aFromIndex the index (inclusive) of the first element in the
7886      *                   first array to be tested
7887      * @param aToIndex the index (exclusive) of the last element in the
7888      *                 first array to be tested
7889      * @param b the second array to be tested for a mismatch
7890      * @param bFromIndex the index (inclusive) of the first element in the
7891      *                   second array to be tested
7892      * @param bToIndex the index (exclusive) of the last element in the
7893      *                 second array to be tested
7894      * @return the relative index of the first mismatch between the two arrays
7895      *         over the specified ranges, otherwise {@code -1}.
7896      * @throws IllegalArgumentException
7897      *         if {@code aFromIndex > aToIndex} or


7984      * it follows that the relative index is only valid for the array with the
7985      * larger range.
7986      * Otherwise, there is no mismatch.
7987      *
7988      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
7989      * ranges [{@code aFromIndex}, {@code atoIndex}) and
7990      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
7991      * prefix of length {@code pl} if the following expression is true:
7992      * <pre>{@code
7993      *     pl >= 0 &&
7994      *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
7995      *     Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
7996      *     a[aFromIndex + pl] != b[bFromIndex + pl]
7997      * }</pre>
7998      * Note that a common prefix length of {@code 0} indicates that the first
7999      * elements from each array mismatch.
8000      *
8001      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
8002      * ranges [{@code aFromIndex}, {@code atoIndex}) and
8003      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
8004      * if the following expression is true:
8005      * <pre>{@code
8006      *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
8007      *     Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
8008      *                   b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
8009      * }</pre>
8010      *
8011      * @param a the first array to be tested for a mismatch
8012      * @param aFromIndex the index (inclusive) of the first element in the
8013      *                   first array to be tested
8014      * @param aToIndex the index (exclusive) of the last element in the
8015      *                 first array to be tested
8016      * @param b the second array to be tested for a mismatch
8017      * @param bFromIndex the index (inclusive) of the first element in the
8018      *                   second array to be tested
8019      * @param bToIndex the index (exclusive) of the last element in the
8020      *                 second array to be tested
8021      * @return the relative index of the first mismatch between the two arrays
8022      *         over the specified ranges, otherwise {@code -1}.
8023      * @throws IllegalArgumentException
8024      *         if {@code aFromIndex > aToIndex} or


8111      * it follows that the relative index is only valid for the array with the
8112      * larger range.
8113      * Otherwise, there is no mismatch.
8114      *
8115      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
8116      * ranges [{@code aFromIndex}, {@code atoIndex}) and
8117      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
8118      * prefix of length {@code pl} if the following expression is true:
8119      * <pre>{@code
8120      *     pl >= 0 &&
8121      *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
8122      *     Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
8123      *     a[aFromIndex + pl] != b[bFromIndex + pl]
8124      * }</pre>
8125      * Note that a common prefix length of {@code 0} indicates that the first
8126      * elements from each array mismatch.
8127      *
8128      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
8129      * ranges [{@code aFromIndex}, {@code atoIndex}) and
8130      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
8131      * if the following expression is true:
8132      * <pre>{@code
8133      *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
8134      *     Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
8135      *                   b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
8136      * }</pre>
8137      *
8138      * @param a the first array to be tested for a mismatch
8139      * @param aFromIndex the index (inclusive) of the first element in the
8140      *                   first array to be tested
8141      * @param aToIndex the index (exclusive) of the last element in the
8142      *                 first array to be tested
8143      * @param b the second array to be tested for a mismatch
8144      * @param bFromIndex the index (inclusive) of the first element in the
8145      *                   second array to be tested
8146      * @param bToIndex the index (exclusive) of the last element in the
8147      *                 second array to be tested
8148      * @return the relative index of the first mismatch between the two arrays
8149      *         over the specified ranges, otherwise {@code -1}.
8150      * @throws IllegalArgumentException
8151      *         if {@code aFromIndex > aToIndex} or


8238      * it follows that the relative index is only valid for the array with the
8239      * larger range.
8240      * Otherwise, there is no mismatch.
8241      *
8242      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
8243      * ranges [{@code aFromIndex}, {@code atoIndex}) and
8244      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
8245      * prefix of length {@code pl} if the following expression is true:
8246      * <pre>{@code
8247      *     pl >= 0 &&
8248      *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
8249      *     Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
8250      *     Float.compare(a[aFromIndex + pl], b[bFromIndex + pl]) != 0
8251      * }</pre>
8252      * Note that a common prefix length of {@code 0} indicates that the first
8253      * elements from each array mismatch.
8254      *
8255      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
8256      * ranges [{@code aFromIndex}, {@code atoIndex}) and
8257      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
8258      * if the following expression is true:
8259      * <pre>{@code
8260      *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
8261      *     Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
8262      *                   b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
8263      * }</pre>
8264      *
8265      * @param a the first array to be tested for a mismatch
8266      * @param aFromIndex the index (inclusive) of the first element in the
8267      *                   first array to be tested
8268      * @param aToIndex the index (exclusive) of the last element in the
8269      *                 first array to be tested
8270      * @param b the second array to be tested for a mismatch
8271      * @param bFromIndex the index (inclusive) of the first element in the
8272      *                   second array to be tested
8273      * @param bToIndex the index (exclusive) of the last element in the
8274      *                 second array to be tested
8275      * @return the relative index of the first mismatch between the two arrays
8276      *         over the specified ranges, otherwise {@code -1}.
8277      * @throws IllegalArgumentException
8278      *         if {@code aFromIndex > aToIndex} or


8365      * it follows that the relative index is only valid for the array with the
8366      * larger range.
8367      * Otherwise, there is no mismatch.
8368      *
8369      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
8370      * ranges [{@code aFromIndex}, {@code atoIndex}) and
8371      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
8372      * prefix of length {@code pl} if the following expression is true:
8373      * <pre>{@code
8374      *     pl >= 0 &&
8375      *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
8376      *     Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
8377      *     Double.compare(a[aFromIndex + pl], b[bFromIndex + pl]) != 0
8378      * }</pre>
8379      * Note that a common prefix length of {@code 0} indicates that the first
8380      * elements from each array mismatch.
8381      *
8382      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
8383      * ranges [{@code aFromIndex}, {@code atoIndex}) and
8384      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
8385      * if the following expression is true:
8386      * <pre>{@code
8387      *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
8388      *     Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
8389      *                   b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
8390      * }</pre>
8391      *
8392      * @param a the first array to be tested for a mismatch
8393      * @param aFromIndex the index (inclusive) of the first element in the
8394      *                   first array to be tested
8395      * @param aToIndex the index (exclusive) of the last element in the
8396      *                 first array to be tested
8397      * @param b the second array to be tested for a mismatch
8398      * @param bFromIndex the index (inclusive) of the first element in the
8399      *                   second array to be tested
8400      * @param bToIndex the index (exclusive) of the last element in the
8401      *                 second array to be tested
8402      * @return the relative index of the first mismatch between the two arrays
8403      *         over the specified ranges, otherwise {@code -1}.
8404      * @throws IllegalArgumentException
8405      *         if {@code aFromIndex > aToIndex} or


8496      * it follows that the relative index is only valid for the array with the
8497      * larger range.
8498      * Otherwise, there is no mismatch.
8499      *
8500      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
8501      * ranges [{@code aFromIndex}, {@code atoIndex}) and
8502      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
8503      * prefix of length {@code pl} if the following expression is true:
8504      * <pre>{@code
8505      *     pl >= 0 &&
8506      *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
8507      *     Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
8508      *     !Objects.equals(a[aFromIndex + pl], b[bFromIndex + pl])
8509      * }</pre>
8510      * Note that a common prefix length of {@code 0} indicates that the first
8511      * elements from each array mismatch.
8512      *
8513      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
8514      * ranges [{@code aFromIndex}, {@code atoIndex}) and
8515      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
8516      * if the following expression is true:
8517      * <pre>{@code
8518      *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
8519      *     Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
8520      *                   b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
8521      * }</pre>
8522      *
8523      * @param a the first array to be tested for a mismatch
8524      * @param aFromIndex the index (inclusive) of the first element in the
8525      *                   first array to be tested
8526      * @param aToIndex the index (exclusive) of the last element in the
8527      *                 first array to be tested
8528      * @param b the second array to be tested for a mismatch
8529      * @param bFromIndex the index (inclusive) of the first element in the
8530      *                   second array to be tested
8531      * @param bToIndex the index (exclusive) of the last element in the
8532      *                 second array to be tested
8533      * @return the relative index of the first mismatch between the two arrays
8534      *         over the specified ranges, otherwise {@code -1}.
8535      * @throws IllegalArgumentException
8536      *         if {@code aFromIndex > aToIndex} or


8642      * it follows that the relative index is only valid for the array with the
8643      * larger range.
8644      * Otherwise, there is no mismatch.
8645      *
8646      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
8647      * ranges [{@code aFromIndex}, {@code atoIndex}) and
8648      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
8649      * prefix of length {@code pl} if the following expression is true:
8650      * <pre>{@code
8651      *     pl >= 0 &&
8652      *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
8653      *     Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl, cmp) &&
8654      *     cmp.compare(a[aFromIndex + pl], b[bFromIndex + pl]) != 0
8655      * }</pre>
8656      * Note that a common prefix length of {@code 0} indicates that the first
8657      * elements from each array mismatch.
8658      *
8659      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
8660      * ranges [{@code aFromIndex}, {@code atoIndex}) and
8661      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
8662      * if the following expression is true:
8663      * <pre>{@code
8664      *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
8665      *     Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
8666      *                   b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
8667      *                   cmp)
8668      * }</pre>
8669      *
8670      * @param a the first array to be tested for a mismatch
8671      * @param aFromIndex the index (inclusive) of the first element in the
8672      *                   first array to be tested
8673      * @param aToIndex the index (exclusive) of the last element in the
8674      *                 first array to be tested
8675      * @param b the second array to be tested for a mismatch
8676      * @param bFromIndex the index (inclusive) of the first element in the
8677      *                   second array to be tested
8678      * @param bToIndex the index (exclusive) of the last element in the
8679      *                 second array to be tested
8680      * @param cmp the comparator to compare array elements
8681      * @param <T> the type of array elements
8682      * @return the relative index of the first mismatch between the two arrays




2777         int bLength = bToIndex - bFromIndex;
2778         if (aLength != bLength)
2779             return false;
2780 
2781         return ArraysSupport.mismatch(a, aFromIndex,
2782                                       b, bFromIndex,
2783                                       aLength) < 0;
2784     }
2785 
2786     /**
2787      * Returns {@code true} if the two specified arrays of doubles are
2788      * <i>equal</i> to one another.  Two arrays are considered equal if both
2789      * arrays contain the same number of elements, and all corresponding pairs
2790      * of elements in the two arrays are equal.  In other words, two arrays
2791      * are equal if they contain the same elements in the same order.  Also,
2792      * two array references are considered equal if both are {@code null}.
2793      *
2794      * Two doubles {@code d1} and {@code d2} are considered equal if:
2795      * <pre>    {@code new Double(d1).equals(new Double(d2))}</pre>
2796      * (Unlike the {@code ==} operator, this method considers
2797      * {@code NaN} equal to itself, and 0.0d unequal to -0.0d.)
2798      *
2799      * @param a one array to be tested for equality
2800      * @param a2 the other array to be tested for equality
2801      * @return {@code true} if the two arrays are equal
2802      * @see Double#equals(Object)
2803      */
2804     public static boolean equals(double[] a, double[] a2) {
2805         if (a==a2)
2806             return true;
2807         if (a==null || a2==null)
2808             return false;
2809 
2810         int length = a.length;
2811         if (a2.length != length)
2812             return false;
2813 
2814         return ArraysSupport.mismatch(a, a2, length) < 0;
2815     }
2816 
2817     /**
2818      * Returns true if the two specified arrays of doubles, over the specified
2819      * ranges, are <i>equal</i> to one another.
2820      *
2821      * <p>Two arrays are considered equal if the number of elements covered by
2822      * each range is the same, and all corresponding pairs of elements over the
2823      * specified ranges in the two arrays are equal.  In other words, two arrays
2824      * are equal if they contain, over the specified ranges, the same elements
2825      * in the same order.
2826      *
2827      * <p>Two doubles {@code d1} and {@code d2} are considered equal if:
2828      * <pre>    {@code new Double(d1).equals(new Double(d2))}</pre>
2829      * (Unlike the {@code ==} operator, this method considers
2830      * {@code NaN} equal to itself, and 0.0d unequal to -0.0d.)
2831      *
2832      * @param a the first array to be tested for equality
2833      * @param aFromIndex the index (inclusive) of the first element in the
2834      *                   first array to be tested
2835      * @param aToIndex the index (exclusive) of the last element in the
2836      *                 first array to be tested
2837      * @param b the second array to be tested for equality
2838      * @param bFromIndex the index (inclusive) of the first element in the
2839      *                   second array to be tested
2840      * @param bToIndex the index (exclusive) of the last element in the
2841      *                 second array to be tested
2842      * @return {@code true} if the two arrays, over the specified ranges, are
2843      *         equal
2844      * @throws IllegalArgumentException
2845      *         if {@code aFromIndex > aToIndex} or
2846      *         if {@code bFromIndex > bToIndex}
2847      * @throws ArrayIndexOutOfBoundsException
2848      *         if {@code aFromIndex < 0 or aToIndex > a.length} or
2849      *         if {@code bFromIndex < 0 or bToIndex > b.length}
2850      * @throws NullPointerException


2860         int aLength = aToIndex - aFromIndex;
2861         int bLength = bToIndex - bFromIndex;
2862         if (aLength != bLength)
2863             return false;
2864 
2865         return ArraysSupport.mismatch(a, aFromIndex,
2866                                       b, bFromIndex, aLength) < 0;
2867     }
2868 
2869     /**
2870      * Returns {@code true} if the two specified arrays of floats are
2871      * <i>equal</i> to one another.  Two arrays are considered equal if both
2872      * arrays contain the same number of elements, and all corresponding pairs
2873      * of elements in the two arrays are equal.  In other words, two arrays
2874      * are equal if they contain the same elements in the same order.  Also,
2875      * two array references are considered equal if both are {@code null}.
2876      *
2877      * Two floats {@code f1} and {@code f2} are considered equal if:
2878      * <pre>    {@code new Float(f1).equals(new Float(f2))}</pre>
2879      * (Unlike the {@code ==} operator, this method considers
2880      * {@code NaN} equal to itself, and 0.0f unequal to -0.0f.)
2881      *
2882      * @param a one array to be tested for equality
2883      * @param a2 the other array to be tested for equality
2884      * @return {@code true} if the two arrays are equal
2885      * @see Float#equals(Object)
2886      */
2887     public static boolean equals(float[] a, float[] a2) {
2888         if (a==a2)
2889             return true;
2890         if (a==null || a2==null)
2891             return false;
2892 
2893         int length = a.length;
2894         if (a2.length != length)
2895             return false;
2896 
2897         return ArraysSupport.mismatch(a, a2, length) < 0;
2898     }
2899 
2900     /**
2901      * Returns true if the two specified arrays of floats, over the specified
2902      * ranges, are <i>equal</i> to one another.
2903      *
2904      * <p>Two arrays are considered equal if the number of elements covered by
2905      * each range is the same, and all corresponding pairs of elements over the
2906      * specified ranges in the two arrays are equal.  In other words, two arrays
2907      * are equal if they contain, over the specified ranges, the same elements
2908      * in the same order.
2909      *
2910      * <p>Two floats {@code f1} and {@code f2} are considered equal if:
2911      * <pre>    {@code new Float(f1).equals(new Float(f2))}</pre>
2912      * (Unlike the {@code ==} operator, this method considers
2913      * {@code NaN} equal to itself, and 0.0f unequal to -0.0f.)
2914      *
2915      * @param a the first array to be tested for equality
2916      * @param aFromIndex the index (inclusive) of the first element in the
2917      *                   first array to be tested
2918      * @param aToIndex the index (exclusive) of the last element in the
2919      *                 first array to be tested
2920      * @param b the second array to be tested for equality
2921      * @param bFromIndex the index (inclusive) of the first element in the
2922      *                   second array to be tested
2923      * @param bToIndex the index (exclusive) of the last element in the
2924      *                 second array to be tested
2925      * @return {@code true} if the two arrays, over the specified ranges, are
2926      *         equal
2927      * @throws IllegalArgumentException
2928      *         if {@code aFromIndex > aToIndex} or
2929      *         if {@code bFromIndex > bToIndex}
2930      * @throws ArrayIndexOutOfBoundsException
2931      *         if {@code aFromIndex < 0 or aToIndex > a.length} or
2932      *         if {@code bFromIndex < 0 or bToIndex > b.length}
2933      * @throws NullPointerException


7476      * it follows that the relative index is only valid for the array with the
7477      * larger range.
7478      * Otherwise, there is no mismatch.
7479      *
7480      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
7481      * ranges [{@code aFromIndex}, {@code atoIndex}) and
7482      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
7483      * prefix of length {@code pl} if the following expression is true:
7484      * <pre>{@code
7485      *     pl >= 0 &&
7486      *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
7487      *     Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
7488      *     a[aFromIndex + pl] != b[bFromIndex + pl]
7489      * }</pre>
7490      * Note that a common prefix length of {@code 0} indicates that the first
7491      * elements from each array mismatch.
7492      *
7493      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
7494      * ranges [{@code aFromIndex}, {@code atoIndex}) and
7495      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
7496      * prefix if the following expression is true:
7497      * <pre>{@code
7498      *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
7499      *     Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
7500      *                   b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
7501      * }</pre>
7502      *
7503      * @param a the first array to be tested for a mismatch
7504      * @param aFromIndex the index (inclusive) of the first element in the
7505      *                   first array to be tested
7506      * @param aToIndex the index (exclusive) of the last element in the
7507      *                 first array to be tested
7508      * @param b the second array to be tested for a mismatch
7509      * @param bFromIndex the index (inclusive) of the first element in the
7510      *                   second array to be tested
7511      * @param bToIndex the index (exclusive) of the last element in the
7512      *                 second array to be tested
7513      * @return the relative index of the first mismatch between the two arrays
7514      *         over the specified ranges, otherwise {@code -1}.
7515      * @throws IllegalArgumentException
7516      *         if {@code aFromIndex > aToIndex} or


7603      * it follows that the relative index is only valid for the array with the
7604      * larger range.
7605      * Otherwise, there is no mismatch.
7606      *
7607      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
7608      * ranges [{@code aFromIndex}, {@code atoIndex}) and
7609      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
7610      * prefix of length {@code pl} if the following expression is true:
7611      * <pre>{@code
7612      *     pl >= 0 &&
7613      *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
7614      *     Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
7615      *     a[aFromIndex + pl] != b[bFromIndex + pl]
7616      * }</pre>
7617      * Note that a common prefix length of {@code 0} indicates that the first
7618      * elements from each array mismatch.
7619      *
7620      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
7621      * ranges [{@code aFromIndex}, {@code atoIndex}) and
7622      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
7623      * prefix if the following expression is true:
7624      * <pre>{@code
7625      *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
7626      *     Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
7627      *                   b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
7628      * }</pre>
7629      *
7630      * @param a the first array to be tested for a mismatch
7631      * @param aFromIndex the index (inclusive) of the first element in the
7632      *                   first array to be tested
7633      * @param aToIndex the index (exclusive) of the last element in the
7634      *                 first array to be tested
7635      * @param b the second array to be tested for a mismatch
7636      * @param bFromIndex the index (inclusive) of the first element in the
7637      *                   second array to be tested
7638      * @param bToIndex the index (exclusive) of the last element in the
7639      *                 second array to be tested
7640      * @return the relative index of the first mismatch between the two arrays
7641      *         over the specified ranges, otherwise {@code -1}.
7642      * @throws IllegalArgumentException
7643      *         if {@code aFromIndex > aToIndex} or


7730      * it follows that the relative index is only valid for the array with the
7731      * larger range.
7732      * Otherwise, there is no mismatch.
7733      *
7734      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
7735      * ranges [{@code aFromIndex}, {@code atoIndex}) and
7736      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
7737      * prefix of length {@code pl} if the following expression is true:
7738      * <pre>{@code
7739      *     pl >= 0 &&
7740      *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
7741      *     Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
7742      *     a[aFromIndex + pl] != b[bFromIndex + pl]
7743      * }</pre>
7744      * Note that a common prefix length of {@code 0} indicates that the first
7745      * elements from each array mismatch.
7746      *
7747      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
7748      * ranges [{@code aFromIndex}, {@code atoIndex}) and
7749      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
7750      * prefix if the following expression is true:
7751      * <pre>{@code
7752      *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
7753      *     Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
7754      *                   b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
7755      * }</pre>
7756      *
7757      * @param a the first array to be tested for a mismatch
7758      * @param aFromIndex the index (inclusive) of the first element in the
7759      *                   first array to be tested
7760      * @param aToIndex the index (exclusive) of the last element in the
7761      *                 first array to be tested
7762      * @param b the second array to be tested for a mismatch
7763      * @param bFromIndex the index (inclusive) of the first element in the
7764      *                   second array to be tested
7765      * @param bToIndex the index (exclusive) of the last element in the
7766      *                 second array to be tested
7767      * @return the relative index of the first mismatch between the two arrays
7768      *         over the specified ranges, otherwise {@code -1}.
7769      * @throws IllegalArgumentException
7770      *         if {@code aFromIndex > aToIndex} or


7857      * it follows that the relative index is only valid for the array with the
7858      * larger range.
7859      * Otherwise, there is no mismatch.
7860      *
7861      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
7862      * ranges [{@code aFromIndex}, {@code atoIndex}) and
7863      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
7864      * prefix of length {@code pl} if the following expression is true:
7865      * <pre>{@code
7866      *     pl >= 0 &&
7867      *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
7868      *     Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
7869      *     a[aFromIndex + pl] != b[bFromIndex + pl]
7870      * }</pre>
7871      * Note that a common prefix length of {@code 0} indicates that the first
7872      * elements from each array mismatch.
7873      *
7874      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
7875      * ranges [{@code aFromIndex}, {@code atoIndex}) and
7876      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
7877      * prefix if the following expression is true:
7878      * <pre>{@code
7879      *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
7880      *     Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
7881      *                   b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
7882      * }</pre>
7883      *
7884      * @param a the first array to be tested for a mismatch
7885      * @param aFromIndex the index (inclusive) of the first element in the
7886      *                   first array to be tested
7887      * @param aToIndex the index (exclusive) of the last element in the
7888      *                 first array to be tested
7889      * @param b the second array to be tested for a mismatch
7890      * @param bFromIndex the index (inclusive) of the first element in the
7891      *                   second array to be tested
7892      * @param bToIndex the index (exclusive) of the last element in the
7893      *                 second array to be tested
7894      * @return the relative index of the first mismatch between the two arrays
7895      *         over the specified ranges, otherwise {@code -1}.
7896      * @throws IllegalArgumentException
7897      *         if {@code aFromIndex > aToIndex} or


7984      * it follows that the relative index is only valid for the array with the
7985      * larger range.
7986      * Otherwise, there is no mismatch.
7987      *
7988      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
7989      * ranges [{@code aFromIndex}, {@code atoIndex}) and
7990      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
7991      * prefix of length {@code pl} if the following expression is true:
7992      * <pre>{@code
7993      *     pl >= 0 &&
7994      *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
7995      *     Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
7996      *     a[aFromIndex + pl] != b[bFromIndex + pl]
7997      * }</pre>
7998      * Note that a common prefix length of {@code 0} indicates that the first
7999      * elements from each array mismatch.
8000      *
8001      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
8002      * ranges [{@code aFromIndex}, {@code atoIndex}) and
8003      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
8004      * prefix if the following expression is true:
8005      * <pre>{@code
8006      *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
8007      *     Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
8008      *                   b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
8009      * }</pre>
8010      *
8011      * @param a the first array to be tested for a mismatch
8012      * @param aFromIndex the index (inclusive) of the first element in the
8013      *                   first array to be tested
8014      * @param aToIndex the index (exclusive) of the last element in the
8015      *                 first array to be tested
8016      * @param b the second array to be tested for a mismatch
8017      * @param bFromIndex the index (inclusive) of the first element in the
8018      *                   second array to be tested
8019      * @param bToIndex the index (exclusive) of the last element in the
8020      *                 second array to be tested
8021      * @return the relative index of the first mismatch between the two arrays
8022      *         over the specified ranges, otherwise {@code -1}.
8023      * @throws IllegalArgumentException
8024      *         if {@code aFromIndex > aToIndex} or


8111      * it follows that the relative index is only valid for the array with the
8112      * larger range.
8113      * Otherwise, there is no mismatch.
8114      *
8115      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
8116      * ranges [{@code aFromIndex}, {@code atoIndex}) and
8117      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
8118      * prefix of length {@code pl} if the following expression is true:
8119      * <pre>{@code
8120      *     pl >= 0 &&
8121      *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
8122      *     Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
8123      *     a[aFromIndex + pl] != b[bFromIndex + pl]
8124      * }</pre>
8125      * Note that a common prefix length of {@code 0} indicates that the first
8126      * elements from each array mismatch.
8127      *
8128      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
8129      * ranges [{@code aFromIndex}, {@code atoIndex}) and
8130      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
8131      * prefix if the following expression is true:
8132      * <pre>{@code
8133      *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
8134      *     Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
8135      *                   b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
8136      * }</pre>
8137      *
8138      * @param a the first array to be tested for a mismatch
8139      * @param aFromIndex the index (inclusive) of the first element in the
8140      *                   first array to be tested
8141      * @param aToIndex the index (exclusive) of the last element in the
8142      *                 first array to be tested
8143      * @param b the second array to be tested for a mismatch
8144      * @param bFromIndex the index (inclusive) of the first element in the
8145      *                   second array to be tested
8146      * @param bToIndex the index (exclusive) of the last element in the
8147      *                 second array to be tested
8148      * @return the relative index of the first mismatch between the two arrays
8149      *         over the specified ranges, otherwise {@code -1}.
8150      * @throws IllegalArgumentException
8151      *         if {@code aFromIndex > aToIndex} or


8238      * it follows that the relative index is only valid for the array with the
8239      * larger range.
8240      * Otherwise, there is no mismatch.
8241      *
8242      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
8243      * ranges [{@code aFromIndex}, {@code atoIndex}) and
8244      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
8245      * prefix of length {@code pl} if the following expression is true:
8246      * <pre>{@code
8247      *     pl >= 0 &&
8248      *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
8249      *     Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
8250      *     Float.compare(a[aFromIndex + pl], b[bFromIndex + pl]) != 0
8251      * }</pre>
8252      * Note that a common prefix length of {@code 0} indicates that the first
8253      * elements from each array mismatch.
8254      *
8255      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
8256      * ranges [{@code aFromIndex}, {@code atoIndex}) and
8257      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
8258      * prefix if the following expression is true:
8259      * <pre>{@code
8260      *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
8261      *     Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
8262      *                   b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
8263      * }</pre>
8264      *
8265      * @param a the first array to be tested for a mismatch
8266      * @param aFromIndex the index (inclusive) of the first element in the
8267      *                   first array to be tested
8268      * @param aToIndex the index (exclusive) of the last element in the
8269      *                 first array to be tested
8270      * @param b the second array to be tested for a mismatch
8271      * @param bFromIndex the index (inclusive) of the first element in the
8272      *                   second array to be tested
8273      * @param bToIndex the index (exclusive) of the last element in the
8274      *                 second array to be tested
8275      * @return the relative index of the first mismatch between the two arrays
8276      *         over the specified ranges, otherwise {@code -1}.
8277      * @throws IllegalArgumentException
8278      *         if {@code aFromIndex > aToIndex} or


8365      * it follows that the relative index is only valid for the array with the
8366      * larger range.
8367      * Otherwise, there is no mismatch.
8368      *
8369      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
8370      * ranges [{@code aFromIndex}, {@code atoIndex}) and
8371      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
8372      * prefix of length {@code pl} if the following expression is true:
8373      * <pre>{@code
8374      *     pl >= 0 &&
8375      *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
8376      *     Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
8377      *     Double.compare(a[aFromIndex + pl], b[bFromIndex + pl]) != 0
8378      * }</pre>
8379      * Note that a common prefix length of {@code 0} indicates that the first
8380      * elements from each array mismatch.
8381      *
8382      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
8383      * ranges [{@code aFromIndex}, {@code atoIndex}) and
8384      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
8385      * prefix if the following expression is true:
8386      * <pre>{@code
8387      *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
8388      *     Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
8389      *                   b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
8390      * }</pre>
8391      *
8392      * @param a the first array to be tested for a mismatch
8393      * @param aFromIndex the index (inclusive) of the first element in the
8394      *                   first array to be tested
8395      * @param aToIndex the index (exclusive) of the last element in the
8396      *                 first array to be tested
8397      * @param b the second array to be tested for a mismatch
8398      * @param bFromIndex the index (inclusive) of the first element in the
8399      *                   second array to be tested
8400      * @param bToIndex the index (exclusive) of the last element in the
8401      *                 second array to be tested
8402      * @return the relative index of the first mismatch between the two arrays
8403      *         over the specified ranges, otherwise {@code -1}.
8404      * @throws IllegalArgumentException
8405      *         if {@code aFromIndex > aToIndex} or


8496      * it follows that the relative index is only valid for the array with the
8497      * larger range.
8498      * Otherwise, there is no mismatch.
8499      *
8500      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
8501      * ranges [{@code aFromIndex}, {@code atoIndex}) and
8502      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
8503      * prefix of length {@code pl} if the following expression is true:
8504      * <pre>{@code
8505      *     pl >= 0 &&
8506      *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
8507      *     Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
8508      *     !Objects.equals(a[aFromIndex + pl], b[bFromIndex + pl])
8509      * }</pre>
8510      * Note that a common prefix length of {@code 0} indicates that the first
8511      * elements from each array mismatch.
8512      *
8513      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
8514      * ranges [{@code aFromIndex}, {@code atoIndex}) and
8515      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
8516      * prefix if the following expression is true:
8517      * <pre>{@code
8518      *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
8519      *     Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
8520      *                   b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
8521      * }</pre>
8522      *
8523      * @param a the first array to be tested for a mismatch
8524      * @param aFromIndex the index (inclusive) of the first element in the
8525      *                   first array to be tested
8526      * @param aToIndex the index (exclusive) of the last element in the
8527      *                 first array to be tested
8528      * @param b the second array to be tested for a mismatch
8529      * @param bFromIndex the index (inclusive) of the first element in the
8530      *                   second array to be tested
8531      * @param bToIndex the index (exclusive) of the last element in the
8532      *                 second array to be tested
8533      * @return the relative index of the first mismatch between the two arrays
8534      *         over the specified ranges, otherwise {@code -1}.
8535      * @throws IllegalArgumentException
8536      *         if {@code aFromIndex > aToIndex} or


8642      * it follows that the relative index is only valid for the array with the
8643      * larger range.
8644      * Otherwise, there is no mismatch.
8645      *
8646      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
8647      * ranges [{@code aFromIndex}, {@code atoIndex}) and
8648      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
8649      * prefix of length {@code pl} if the following expression is true:
8650      * <pre>{@code
8651      *     pl >= 0 &&
8652      *     pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
8653      *     Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl, cmp) &&
8654      *     cmp.compare(a[aFromIndex + pl], b[bFromIndex + pl]) != 0
8655      * }</pre>
8656      * Note that a common prefix length of {@code 0} indicates that the first
8657      * elements from each array mismatch.
8658      *
8659      * <p>Two non-{@code null} arrays, {@code a} and {@code b} with specified
8660      * ranges [{@code aFromIndex}, {@code atoIndex}) and
8661      * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
8662      * prefix if the following expression is true:
8663      * <pre>{@code
8664      *     (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
8665      *     Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
8666      *                   b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
8667      *                   cmp)
8668      * }</pre>
8669      *
8670      * @param a the first array to be tested for a mismatch
8671      * @param aFromIndex the index (inclusive) of the first element in the
8672      *                   first array to be tested
8673      * @param aToIndex the index (exclusive) of the last element in the
8674      *                 first array to be tested
8675      * @param b the second array to be tested for a mismatch
8676      * @param bFromIndex the index (inclusive) of the first element in the
8677      *                   second array to be tested
8678      * @param bToIndex the index (exclusive) of the last element in the
8679      *                 second array to be tested
8680      * @param cmp the comparator to compare array elements
8681      * @param <T> the type of array elements
8682      * @return the relative index of the first mismatch between the two arrays


< prev index next >