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:se.kodapan.io.http.wayback.WaybackHeader.java

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

    WaybackHeader that = (WaybackHeader) o;

    if (!Arrays.equals(elements, that.elements))
        return false;
    if (name != null ? !name.equals(that.name) : that.name != null)
        return false;
    if (value != null ? !value.equals(that.value) : that.value != null)
        return false;

    return true;/*from  w w  w. ja v  a 2 s .com*/
}

From source file:com.talis.storage.SubmittedItemTest.java

@Test
public void getEntityReturnsInputStreamFromConstructorUnread() throws IOException {
    byte[] data = UUID.randomUUID().toString().getBytes();
    InputStream entity = new ByteArrayInputStream(data);
    SubmittedItem submittedItem = new SubmittedItem(MediaType.TEXT_PLAIN_TYPE, entity);
    assertSame(entity, submittedItem.getEntity());
    assertTrue(Arrays.equals(data, IOUtils.toByteArray(submittedItem.getEntity())));
}

From source file:com.mac.hazewinkel.plist.datamodel.PListData.java

@Override
public boolean equals(Object obj) {
    if (!(obj instanceof PListData))
        return false;
    return Arrays.equals(getValue(), ((PListData) obj).getValue());
}

From source file:com.opengamma.analytics.math.interpolation.data.Interpolator2DDataBundle.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }//from   ww  w. jav a 2s  .  co m
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final Interpolator2DDataBundle other = (Interpolator2DDataBundle) obj;
    if (!Arrays.equals(_xData, other._xData)) {
        return false;
    }
    if (!Arrays.equals(_yData, other._yData)) {
        return false;
    }
    return Arrays.equals(_zData, other._zData);
}

From source file:com.cloudant.sync.datastore.BasicDBBodyTest.java

@Test(expected = IllegalArgumentException.class)
public void constructor_invalidInput_objectWithEmptyJsonShouldBeCreated() {
    DocumentBody body = new BasicDocumentBody("[]".getBytes());
    Assert.assertTrue(Arrays.equals("{}".getBytes(), body.asBytes()));
    Assert.assertNotNull(body.asMap());//from  w  ww . jav  a 2 s . c  o  m
    Assert.assertTrue(body.asMap().size() == 0);
}

From source file:com.google.code.rptm.mailarchive.DefaultMailingListArchive.java

private static boolean isMboxFile(File file) throws IOException {
    byte[] firstBytes = new byte[5];
    DataInputStream in = new DataInputStream(new FileInputStream(file));
    try {/*from   w w  w  .  j av  a  2  s  .c o  m*/
        in.readFully(firstBytes);
    } finally {
        in.close();
    }
    return Arrays.equals(firstBytes, MBOX_MAGIC);
}

From source file:org.opensafety.hishare.managers.implementation.http.AuthenticationServerManagerImpl.java

public boolean authenticationServerVerify(String authenticationServerName, byte[] hashedPassword) {
    return Arrays.equals(authenticationServerDao.getPassword(authenticationServerName), hashedPassword);
}

From source file:io.neba.core.util.Key.java

@Override
public boolean equals(Object obj) {
    return obj == this || obj != null && obj.getClass() == getClass()
            && Arrays.equals(this.contents, ((Key) obj).contents);
}

From source file:co.cask.cdap.cli.CLIMainArgs.java

@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }/*  w ww .ja va 2  s  . c  om*/
    if (obj == null || getClass() != obj.getClass()) {
        return false;
    }
    final CLIMainArgs other = (CLIMainArgs) obj;
    return Arrays.equals(this.optionTokens, other.optionTokens)
            && Arrays.equals(this.commandTokens, other.commandTokens);
}

From source file:com.springcryptoutils.core.cipher.symmetric.KeyGeneratorImplSpecificProviderTest.java

@Test
public void testGenerator() {
    assertNotNull(generator);//  w w w.j  ava2s.  com

    byte[] key1 = generator.generate();
    byte[] key2 = generator.generate();
    byte[] key3 = generator.generate();

    assertNotNull(key1);
    assertNotNull(key2);
    assertNotNull(key3);

    assertTrue(key1.length > 0);
    assertTrue(key2.length > 0);
    assertTrue(key3.length > 0);

    assertFalse(Arrays.equals(key1, key2));
    assertFalse(Arrays.equals(key1, key3));
    assertFalse(Arrays.equals(key2, key3));
}