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.eviware.loadui.util.testevents.TestEventSourceSupport.java

public final void setData(byte[] newData) {
    if (!Arrays.equals(data, newData)) {
        data = new byte[newData.length];
        System.arraycopy(newData, 0, data, 0, newData.length);
        updateHash();//from   w  w  w .  jav a2  s.c  o  m
    }
}

From source file:elaborate.util.PasswordUtil.java

public static boolean matches(String password, byte[] encodedpassword) {
    return Arrays.equals(encode(password), encodedpassword);
}

From source file:com.enonic.cms.core.portal.instruction.CreateAttachmentUrlInstruction.java

@Override
public boolean equals(Object o) {
    if (this == o) {
        return true;
    }/*www.  ja  va 2 s  . c  om*/
    if (o == null || getClass() != o.getClass()) {
        return false;
    }

    CreateAttachmentUrlInstruction that = (CreateAttachmentUrlInstruction) o;

    if (requestedMenuItemKey != null ? !requestedMenuItemKey.equals(that.requestedMenuItemKey)
            : that.requestedMenuItemKey != null) {
        return false;
    }
    if (nativeLinkKey != null ? !nativeLinkKey.equals(that.nativeLinkKey) : that.nativeLinkKey != null) {
        return false;
    }
    if (!Arrays.equals(params, that.params)) {
        return false;
    }

    return true;
}

From source file:com.dsh105.commodus.config.Options.java

public boolean isLocked(Option option, Object[] condition) {
    return LOCKED.containsKey(option) && Arrays.equals(LOCKED_CONDITION.get(option), condition);
}

From source file:com.dal.vv.type.AbstractValue.java

@Override
public boolean equals(Object obj) {
    if (obj == null) {
        return false;
    }//from   ww w  .ja v  a 2s  .  c o m
    if (getClass() != obj.getClass()) {
        return false;
    }
    final AbstractValue other = (AbstractValue) obj;
    return Arrays.equals(this.value, other.value);
}

From source file:com.espertech.esper.support.util.ArrayAssertionUtil.java

/**
 * Compare the objects in the two 2-dim String arrays assuming the exact same order.
 * @param data is the data to assertEqualsExactOrder against
 * @param expectedValues is the expected values
 *///from  w  w w.j  a v  a2  s.  co  m
public static void assertEqualsStringArr(String[][] data, String[][] expectedValues) {
    if ((expectedValues == null) && (data == null)) {
        return;
    }
    if (((expectedValues == null) && (data != null)) || ((expectedValues != null) && (data == null))) {
        TestCase.assertTrue(false);
    }

    TestCase.assertEquals("mismatch in number to elements", expectedValues.length, data.length);

    for (int i = 0; i < expectedValues.length; i++) {
        TestCase.assertTrue(Arrays.equals(data[i], expectedValues[i]));
    }
}

From source file:com.opengamma.financial.analytics.volatility.surface.FuturePriceCurveDefinition.java

@Override
public boolean equals(final Object o) {
    if (o == null) {
        return false;
    }// w w w . java2  s  .com
    if (!(o instanceof FuturePriceCurveDefinition)) {
        return false;
    }
    final FuturePriceCurveDefinition<?> other = (FuturePriceCurveDefinition<?>) o;
    return other.getTarget().equals(getTarget()) && other.getName().equals(getName())
            && Arrays.equals(other.getXs(), getXs());
}

From source file:com.opengamma.financial.analytics.fxforwardcurve.FXForwardCurveDefinition.java

@Override
public boolean equals(final Object obj) {
    if (obj == null) {
        return false;
    }/*  w  w w  .  j a v  a2 s  . co m*/
    if (!(obj instanceof FXForwardCurveDefinition)) {
        return false;
    }
    final FXForwardCurveDefinition other = (FXForwardCurveDefinition) obj;
    return getTarget().equals(other.getTarget()) && getName().equals(other.getName())
            && Arrays.equals(getTenors(), other.getTenors());
}

From source file:edu.utdallas.bigsecret.cipher.test.TestAesEcb.java

@Test
public void testEncrypt() {
    byte[] key = Bytes.toBytes("1234567890123456");

    try {//w ww.j ava2s.  com
        AesEcb cip = new AesEcb(key);

        byte[] originalData = Bytes.toBytes("mr. anderson, we missed you");

        System.out.println("Original Data: ");
        printArray(originalData);

        byte[] encData = cip.encrypt(originalData);

        System.out.println("Encrypted Data: ");
        printArray(encData);

        byte[] decData = cip.decrypt(encData);

        System.out.println("Decrypted Data: ");
        printArray(decData);

        if (!Arrays.equals(originalData, decData)) {
            fail("AesEcb encryption decryption mechanism failed. Data changes after encryption and decryption!!");
        }
    } catch (Exception e) {
        fail("AesEcb encrypt test failed.");
        e.printStackTrace();
    }
}

From source file:it.geosolutions.geofence.core.model.Base64EncodersTest.java

@Test
public void testEq() {

    String msg1 = "this is the message to encode";

    String output_codec = new String(Base64.encodeBase64(msg1.getBytes()));
    String output_dconv = DatatypeConverter.printBase64Binary(msg1.getBytes());

    System.out.println("apache commons:    " + output_codec);
    System.out.println("DatatypeConverter: " + output_dconv);
    assertEquals(output_codec, output_dconv);

    byte[] back_codec = Base64.decodeBase64(output_dconv);
    byte[] back_dconv = DatatypeConverter.parseBase64Binary(output_dconv);

    Assert.assertTrue(Arrays.equals(msg1.getBytes(), back_codec));
    Assert.assertTrue(Arrays.equals(msg1.getBytes(), back_dconv));

}