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:com.opengamma.analytics.math.linearalgebra.LUDecompositionCommonsResultTest.java

@Test
public void testGetters() {
    assertRealMatrixEquals(L, LU.getL());
    assertRealMatrixEquals(U, LU.getU());
    assertRealMatrixEquals(P, LU.getP());
    assertEquals(DETERMINANT, LU.getDeterminant(), 0);
    assertTrue(Arrays.equals(PIVOT, LU.getPivot()));
}

From source file:com.jivesoftware.os.amza.api.wal.WALValue.java

@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }//from   w  w w.  ja  v  a2  s  .  c  om
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final WALValue other = (WALValue) obj;
    if (this.timestamp != other.timestamp) {
        return false;
    }
    if (this.tombstoned != other.tombstoned) {
        return false;
    }
    if (this.version != other.version) {
        return false;
    }
    if (this.rowType != other.rowType) {
        return false;
    }
    if (!Arrays.equals(this.value, other.value)) {
        return false;
    }
    return true;
}

From source file:net.shibboleth.idp.attribute.ByteAttributeValue.java

/** {@inheritDoc} */
@Override/*from w w w .  j  a  va2 s  .  c  om*/
public boolean equals(@Nullable Object obj) {
    if (obj == null) {
        return false;
    }

    if (obj == this) {
        return true;
    }

    if (!(obj instanceof ByteAttributeValue)) {
        return false;
    }

    final ByteAttributeValue other = (ByteAttributeValue) obj;
    return Arrays.equals(other.value, value);
}

From source file:com.surevine.alfresco.audit.MultiReadHttpServletRequestTest.java

MultiReadHttpServletRequest testRequestWithSize(int size) throws Exception {
    MockHttpServletRequest mockRequest = new MockHttpServletRequest();

    byte[] testData = getTestData(size);

    mockRequest.setContent(testData); // A request

    MultiReadHttpServletRequest request = new MultiReadHttpServletRequest(mockRequest);

    byte[] result1 = IOUtils.toByteArray(request.getInputStream());
    assertTrue("result1 should equal the input array. [" + testData.length + ", " + result1.length + "]",
            Arrays.equals(testData, result1));

    result1 = null;/*  ww w.  ja  v  a2 s.  co  m*/
    System.gc();

    byte[] result2 = IOUtils.toByteArray(request.getInputStream());
    assertTrue("result2 should equal the output array [" + testData.length + ", " + result2.length + "]",
            Arrays.equals(testData, result2));

    testData = null;
    result2 = null;
    System.gc();

    return request;
}

From source file:com.webcohesion.ofx4j.io.BaseOFXReader.java

/**
 * Parse the reader, including the headers.
 *
 * @param reader The reader.//from ww  w . j a  va  2 s .  c om
 */
public void parse(Reader reader) throws IOException, OFXParseException {
    //make sure we're buffering...
    reader = new BufferedReader(reader);

    StringBuilder header = new StringBuilder();
    final char[] firstElementStart = getFirstElementStart();
    final char[] buffer = new char[firstElementStart.length];
    reader.mark(firstElementStart.length);
    int ch = reader.read(buffer);
    while ((ch != -1) && (!Arrays.equals(buffer, firstElementStart))) {
        if (!contains(buffer, '<')) {
            //if the buffer contains a '<', then we might already have marked the beginning.
            reader.mark(firstElementStart.length);
        }
        ch = reader.read();
        char shifted = shiftAndAppend(buffer, (char) ch);
        header.append(shifted);
    }

    if (ch == -1) {
        throw new OFXParseException("Invalid OFX: no root <OFX> element!");
    } else {
        Matcher matcher = OFX_2_PROCESSING_INSTRUCTION_PATTERN.matcher(header);
        if (matcher.find()) {
            if (LOG.isInfoEnabled()) {
                LOG.info("Processing OFX 2 header...");
            }

            processOFXv2Headers(matcher.group(1));
            reader.reset();
            parseV2FromFirstElement(reader);
        } else {
            LOG.info("Processing OFX 1 headers...");
            processOFXv1Headers(header.toString());
            reader.reset();
            parseV1FromFirstElement(reader);
        }
    }
}

From source file:com.opengamma.analytics.math.matrix.DoubleMatrix1D.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }//from  ww  w  .  java2  s  . c  om
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final DoubleMatrix1D other = (DoubleMatrix1D) obj;
    if (!Arrays.equals(_data, other._data)) {
        return false;
    }
    return true;
}

From source file:com.romeikat.datamessie.core.base.service.AuthenticationService.java

public boolean authenticate(final String password, final byte[] passwordSalt, final byte[] passwordHash) {
    final byte[] expectedPasswordHash = calculateHash(password, passwordSalt);
    final boolean passwordHashEquals = Arrays.equals(expectedPasswordHash, passwordHash);
    return passwordHashEquals;
}

From source file:com.opengamma.analytics.financial.credit.ISDAYieldCurveAndSpreadsProvider.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }//w  w  w  .j a v a  2  s .  com
    if (obj == null) {
        return false;
    }
    if (!(obj instanceof ISDAYieldCurveAndSpreadsProvider)) {
        return false;
    }
    final ISDAYieldCurveAndSpreadsProvider other = (ISDAYieldCurveAndSpreadsProvider) obj;
    if (!Arrays.equals(_marketDates, other._marketDates)) {
        return false;
    }
    if (!Arrays.equals(_marketSpreads, other._marketSpreads)) {
        return false;
    }
    if (!ObjectUtils.equals(_yieldCurve, other._yieldCurve)) {
        return false;
    }
    return true;
}

From source file:com.thoughtworks.go.i18n.LocalizedKeyValueMessage.java

private boolean equals(LocalizedKeyValueMessage that) {
    if (!Arrays.equals(this.args, that.args)) {
        return false;
    }//from w ww .  jav a2s . c o  m
    if (!this.key.equals(that.key)) {
        return false;
    }

    return true;
}

From source file:net.ontopia.persistence.query.jdo.JDONativeValue.java

@Override
public boolean equals(Object obj) {
    if (this == obj)
        return true;
    if (obj instanceof JDONativeValue) {
        JDONativeValue other = (JDONativeValue) obj;
        if (root.equals(other.root))
            if (Arrays.equals(args, other.args))
                return true;
    }/*w  ww  .j  a va 2s. c o  m*/
    return false;
}