Java Array Equal equal(float[][] array1, float[][] array2)

Here you can find the source of equal(float[][] array1, float[][] array2)

Description

Tests two float arrays for equality.

License

Open Source License

Parameter

Parameter Description
array1 the first array.
array2 the second arrray.

Return

A boolean.

Declaration

public static boolean equal(float[][] array1, float[][] array2) 

Method Source Code


//package com.java2s;
/*//from ww w .  jav a  2  s.c o m
 * ========================================================================
 * JCommon : a free general purpose class library for the Java(tm) platform
 * ========================================================================
 * (C) Copyright 2000-2004, by Object Refinery Limited and Contributors.
 * Project Info: http://www.jfree.org/jcommon/index.html
 * This library is free software; you can redistribute it and/or modify it under the terms
 * of the GNU Lesser General Public License as published by the Free Software Foundation;
 * either version 2.1 of the License, or (at your option) any later version.
 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Lesser General Public License for more details.
 * You should have received a copy of the GNU Lesser General Public License along with this
 * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307, USA.
 * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
 * in the United States and other countries.]
 * ---------------
 * ArrayUtils.java
 * ---------------
 * (C) Copyright 2003, 2004, by Object Refinery Limited.
 * Original Author: David Gilbert (for Object Refinery Limited);
 * Contributor(s): -;
 * $Id: ArrayUtils.java,v 1.1 2011-01-31 09:01:40 klukas Exp $
 * Changes
 * -------
 * 21-Aug-2003 : Version 1 (DG);
 */

import java.util.Arrays;

public class Main {
    /**
     * Tests two float arrays for equality.
     * 
     * @param array1
     *           the first array.
     * @param array2
     *           the second arrray.
     * @return A boolean.
     */
    public static boolean equal(float[][] array1, float[][] array2) {
        if (array1 == null) {
            return (array2 == null);
        }

        if (array2 == null) {
            return false;
        }

        if (array1.length != array2.length) {
            return false;
        }

        for (int i = 0; i < array1.length; i++) {
            if (!Arrays.equals(array1[i], array2[i])) {
                return false;
            }
        }
        return true;
    }
}

Related

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