Java Utililty Methods Array Equal

List of utility methods to do Array Equal

Description

The list of methods to do Array Equal are organized into topic(s).

Method

booleanequals(final byte[] a, final byte[] b)
Compare two objects, each of them could be null.
if (a == null) {
    if (b == null) {
        return true;
    return false;
return Arrays.equals(a, b);
booleanequals(final byte[] array1, final byte[] array2)
Compara dos arrays de bytes.
if (hasNulls(array1, array2) || array1.length != array2.length) {
    return false;
int i = 0;
while (i < array1.length && array1[i] == array2[i]) {
    i++;
return i == array1.length;
...
booleanequals(final T[][] a, final T[][] b)
equals
if (a == b) {
    return true;
if (a == null || b == null) {
    return false;
if (a.length != b.length) {
    return false;
...
booleanequals(int[] a, int[] b)
Use java.util.Arrays instead.
if (a.length != b.length) {
    return (false);
for (int i = 0; i < a.length; i++) {
    if (a[i] != b[i]) {
        return (false);
return (true);
booleanequals(int[][] ar1, int[][] ar2)
equals
if (ar1.length != ar2.length)
    return false;
for (int[] row1 : ar1) {
    if (!contains(row1, ar2)) {
        return false;
return true;
...
booleanequals(long[] a, long[] a2)
equals
return java.util.Arrays.equals(a, a2);
booleanequals(Map a, Map b)
Implements equals for a map of string arrays The map of string arrays is used in some XPack protocol classes but does't work with equal.
if (a == null) {
    return b == null;
if (b == null) {
    return false;
if (a.size() != b.size()) {
    return false;
...
booleanequals(Map map1, Map map2)
equals
if (map1.keySet().equals(map2.keySet())) {
    for (Map.Entry<String, String[]> parameter : map1.entrySet()) {
        String[] thatParameterValues = map2.get(parameter.getKey());
        if (thatParameterValues != null) {
            if (!Arrays.equals(parameter.getValue(), thatParameterValues)) {
                return false;
    return true;
return false;
booleanequals(Object array1, Object array2)
See if the two arrays are "equal" (not identidy, but that the contents are equal).
if (array1 == array2)
    return true;
if (array1 == null || array2 == null)
    return false;
Class aclass = array1.getClass();
Class bclass = array2.getClass();
if (!aclass.isArray() || !bclass.isArray())
    return false;
...
booleanequals(Object array1, Object array2)
equals
boolean equal = false;
if (array1 == array2) {
    equal = true;
else if (array1 != null && array2 != null && array1.getClass().equals(array2.getClass())) {
    if (array1 instanceof byte[] && array2 instanceof byte[]) {
        equal = Arrays.equals((byte[]) array1, (byte[]) array2);
    } else if (array1 instanceof short[] && array2 instanceof short[]) {
...