Java Array Empty Check areArraysEqual(byte[] arr1, byte[] arr2, boolean dontDistinctNilAndEmpty)

Here you can find the source of areArraysEqual(byte[] arr1, byte[] arr2, boolean dontDistinctNilAndEmpty)

Description

are Arrays Equal

License

Apache License

Declaration

public static boolean areArraysEqual(byte[] arr1, byte[] arr2, boolean dontDistinctNilAndEmpty) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.Arrays;

public class Main {
    public static boolean areArraysEqual(byte[] arr1, byte[] arr2, boolean dontDistinctNilAndEmpty) {
        if (!dontDistinctNilAndEmpty)
            return Arrays.equals(arr1, arr2);
        if (arr1 == null || arr1.length == 0)
            return arr2 == null || arr2.length == 0;
        return Arrays.equals(arr1, arr2);
    }//from  w  w w.j  a  v  a  2  s . c o  m
}

Related

  1. getNonemptySubsets(Object[] objects)
  2. getWithoutEmptyParams(String[] cmdarray)
  3. hasOneEmpty(String[] args)
  4. isEmpty(boolean[] values)