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:buildcraft.builders.blueprints.BlueprintId.java

@Override
public boolean equals(Object obj) {
    if (obj instanceof BlueprintId) {
        return Arrays.equals(uniqueId, ((BlueprintId) obj).uniqueId);
    } else {//from   w  w w.j a  v a 2  s .  com
        return false;
    }
}

From source file:net.darkmist.clf.UtilTest.java

public void testAThenB() throws Exception {
    Integer[] a = new Integer[] { 1, 2, 3, 4, 5 };
    Integer[] b = new Integer[] { 6, 7, 8, 9 };
    Integer[] expected = new Integer[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
    Integer[] actual = new Integer[a.length + b.length];

    Util.merge(a, b, actual, comparator);
    assertTrue(Arrays.equals(actual, expected));
}

From source file:com.cloudant.sync.util.JSONUtilsTest.java

@Test
public void serializeAsBytes() {
    Map obj = new HashMap<String, String>();
    obj.put("name", "the great wall");
    String json = "{\"name\":\"the great wall\"}";
    Arrays.equals(json.getBytes(), JSONUtils.serializeAsBytes(obj));
}

From source file:com.opengamma.analytics.math.integration.GaussianQuadratureData.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }/*from   w  w  w.  j ava2 s  .  com*/
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final GaussianQuadratureData other = (GaussianQuadratureData) obj;
    if (!Arrays.equals(_abscissas, other._abscissas)) {
        return false;
    }
    return Arrays.equals(_weights, other._weights);
}

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

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

    try {/*from  w w  w.j ava 2 s.  c om*/
        AesCtr cip = new AesCtr(key);

        byte[] originalData = Bytes.toBytes("Do you think it's air that you breath?");

        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("AesCtr encryption decryption mechanism failed. Data changes after encryption and decryption!!");
        }
    } catch (Exception e) {
        fail("AesCtr encrypt test failed.");
        e.printStackTrace();
    }
}

From source file:com.adaptris.core.DefaultAdaptrisMessageImp.java

/**
 * @see com.adaptris.core.AdaptrisMessage#equivalentForTracking (com.adaptris.core.AdaptrisMessage)
 *//*from ww w.j a  va  2  s  .c  o m*/
@Override
public boolean equivalentForTracking(AdaptrisMessage other) {
    boolean result = false;

    if (StringUtils.equals(getUniqueId(), other.getUniqueId())) {
        if (Arrays.equals(getPayload(), other.getPayload())) {
            if (StringUtils.equals(getContentEncoding(), other.getContentEncoding())) {
                if (this.getMetadata().equals(other.getMetadata())) {
                    result = true;
                }
            }
        }
    }
    return result;
}

From source file:com.taobao.adfs.util.HashedBytes.java

@Override
public boolean equals(Object obj) {
    if (this == obj)
        return true;
    if (obj == null || getClass() != obj.getClass())
        return false;
    HashedBytes other = (HashedBytes) obj;
    return Arrays.equals(bytes, other.bytes);
}

From source file:baggage.hypertoolkit.security.CipherText.java

@Override
public boolean equals(Object o) {
    if (this == o)
        return true;
    if (o == null || getClass() != o.getClass())
        return false;

    CipherText that = (CipherText) o;//  w w w .  j  a  v a 2 s.c o  m

    if (!Arrays.equals(bytes, that.bytes))
        return false;

    return true;
}

From source file:GenericReflectionTest.java

public static void printTypes(Type[] types, String pre, String sep, String suf, boolean isDefinition) {
    if (pre.equals(" extends ") && Arrays.equals(types, new Type[] { Object.class }))
        return;/*from w ww  .j a va2 s.  c o  m*/
    if (types.length > 0)
        System.out.print(pre);
    for (int i = 0; i < types.length; i++) {
        if (i > 0)
            System.out.print(sep);
        printType(types[i], isDefinition);
    }
    if (types.length > 0)
        System.out.print(suf);
}

From source file:buildcraft.core.blueprints.LibraryId.java

@Override
public boolean equals(Object obj) {
    if (obj instanceof LibraryId) {
        return Arrays.equals(uniqueId, ((LibraryId) obj).uniqueId);
    } else {//  w  ww .  j  ava2  s .  c  o m
        return false;
    }
}