Example usage for java.util Arrays equals

List of usage examples for java.util Arrays equals

Introduction

In this page you can find the example usage for java.util Arrays equals.

Prototype

public static boolean equals(Object[] a, Object[] a2) 

Source Link

Document

Returns true if the two specified arrays of Objects are equal to one another.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {

    boolean b = Arrays.equals(new byte[] { 0 }, new byte[] { 0 }); // true
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    boolean b = Arrays.equals(new double[] { 0D }, new double[] { 0D }); // true
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    boolean b = Arrays.equals(new short[] { 0 }, new short[] { 0 }); // true
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    boolean b = Arrays.equals(new char[] { 'a' }, new char[] { 'a' }); // true
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    boolean b = Arrays.equals(new float[] { 0F }, new float[] { 0F }); // true

}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    boolean b = Arrays.equals(new int[] { 0 }, new int[] { 0 }); // true

}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    boolean b = Arrays.equals(new long[] { 0L }, new long[] { 0L }); // true

}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    boolean b = Arrays.equals(new String[] { "a" }, new String[] { "a" });
    b = Arrays.equals(new String[] { null }, new String[] { null });
    b = Arrays.equals(new String[] { "a" }, new String[] { null });
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    boolean[] bArr1 = null;
    boolean[] bArr2 = null;
    boolean b = Arrays.equals(bArr1, bArr2); // true
}

From source file:Main.java

public static void main(String[] args) {
    int[] a1 = new int[] { 2, 7, 1 };
    int[] a2 = new int[] { 2, 7, 1 };

    System.out.println(Arrays.equals(a1, a2));
}