Java Array Equal equal(int[] a, int[] b)

Here you can find the source of equal(int[] a, int[] b)

Description

Checks if a[i] == b[i] for all i from 0 to a.length (= b.length)

License

Open Source License

Parameter

Parameter Description
a the first array
b the second array

Return

true if a[i] == b[i] for all i from 0 to a.length (= b.length), false otherwise

Declaration

public static boolean equal(int[] a, int[] b) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.*;

public class Main {
    /**/*w  ww  .  ja v a  2 s  .  c  om*/
     * Checks if a[i] == b[i] for all i from 0 to a.length (= b.length)
     * @param a the first array
     * @param b the second array
     * @return true if a[i] == b[i] for all i from 0 to a.length (= b.length), false otherwise
     */
    public static boolean equal(int[] a, int[] b) {
        return Arrays.equals(a, b);
    }

    /**
     * Checks if a[i] == b[i] for all i from 0 to a.length (= b.length)
     * @param a the first array
     * @param b the second array
     * @return true if a[i] == b[i] for all i from 0 to a.length (= b.length), false otherwise
     */
    public static boolean equal(boolean[] a, boolean[] b) {
        return Arrays.equals(a, b);
    }

    /**
     * Checks if a[i] == b[i] for all i from 0 to a.length (= b.length)
     * @param a the first array
     * @param b the second array
     * @return true if a[i] == b[i] for all i from 0 to a.length (= b.length), false otherwise
     */
    public static boolean equal(double[] a, double[] b) {
        return Arrays.equals(a, b);
    }
}

Related

  1. blobsAreEqual(byte[] blob1, byte[] blob2)
  2. bytesAreEqual(byte[] b1, byte[] b2)
  3. equal(boolean[][] a, boolean[][] b)
  4. equal(byte[] a, byte[] b)
  5. equal(float[][] array1, float[][] array2)
  6. equalByRows(boolean[][] a, boolean[][] b)
  7. equalFreqBinning(double[][] sampleData, int numPredVals, int numRespVals, int divInd)
  8. equalIgnoreOrder(final Object[] array1, final Object[] array2)
  9. equalityCheck(byte[] a, byte[] b)