Example usage for java.util Arrays hashCode

List of usage examples for java.util Arrays hashCode

Introduction

In this page you can find the example usage for java.util Arrays hashCode.

Prototype

public static int hashCode(Object a[]) 

Source Link

Document

Returns a hash code based on the contents of the specified array.

Usage

From source file:com.quartercode.disconnected.sim.comp.net.IP.java

@Override
public int hashCode() {

    final int prime = 31;
    int result = 1;
    result = prime * result + Arrays.hashCode(parts);
    return result;
}

From source file:org.rifidi.emulator.reader.sharedrc.tagmemory.RifidiTagMap.java

/**
 * Gets a tag from the tagMap//ww w.j  a  v a  2s.c  o  m
 * 
 * @param id
 * @return
 */
public RifidiTag getTag(byte[] id) {
    return this.tags.get(Arrays.hashCode(id));
}

From source file:org.wso2.carbon.identity.application.common.model.ProvisioningConnectorConfig.java

@Override
public int hashCode() {
    int hashCode = 1;
    hashCode = hashCode * 17 + (name != null ? name.hashCode() : 0);
    hashCode = hashCode * 31 + (provisioningProperties != null ? Arrays.hashCode(provisioningProperties) : 0);
    return hashCode;
}

From source file:org.echocat.velma.ProcessBasedPasswordRequest.java

@Override
public int hashCode() {
    final int result;
    final ExtendedProcess process = getProcess();
    final String mainClass = process.getMainClass();
    if (mainClass != null) {
        result = mainClass.hashCode();//from   www  .j  a  v  a2s. c  om
    } else {
        final byte[] md5 = getMd5();
        if (md5 != null) {
            result = Arrays.hashCode(md5);
        } else {
            result = process.hashCode();
        }
    }
    return result;
}

From source file:org.rapidcontext.core.storage.Path.java

/**
 * Returns a hash code for this object.
 *
 * @return a hash code for this object
 */
public int hashCode() {
    return Arrays.hashCode(parts);
}

From source file:net.sf.jclal.util.random.Ranmar.java

@Override
public int hashCode() {
    int hash = 3;
    hash = 23 * hash + this.i97;
    hash = 23 * hash + this.j97;
    hash = 23 * hash + (int) (Double.doubleToLongBits(this.c) ^ (Double.doubleToLongBits(this.c) >>> 32));
    hash = 23 * hash + Arrays.hashCode(this.u);
    return hash;//from w  ww . j a va  2  s  .  c o m
}

From source file:org.jboss.aerogear.android.pipe.loader.LoaderAdapter.java

@Override
public void read(ReadFilter filter, Callback<List<T>> callback) {
    int id = Arrays.hashCode(new Object[] { name, filter, callback });
    Bundle bundle = new Bundle();
    bundle.putSerializable(CALLBACK, callback);
    bundle.putSerializable(FILTER, filter);
    bundle.putSerializable(METHOD, Methods.READ);
    manager.initLoader(id, bundle, this);
}

From source file:io.viewserver.operators.transpose.TransposeOperator.java

private int getKey(int row, boolean usePreviousValues) {
    if (keyColumns == null || keyColumns.length == 0) {
        return 0;
    }/*from w  ww  .ja  v  a 2 s .c om*/

    int groupKey;
    if (keyColumns.length == 1) {
        groupKey = getKeyComponent(keyColumns[0], row, usePreviousValues);
    } else {
        for (int i = 0; i < keyColumns.length; i++) {
            keyComponents[i] = getKeyComponent(keyColumns[i], row, usePreviousValues);
        }
        groupKey = Arrays.hashCode(keyComponents);
    }
    int groupId = keys.addInt(groupKey);
    if (groupId < 0) {
        groupId = -groupId - 1;
    }
    return groupId;
}

From source file:com.github.richardwilly98.esdms.UserImpl.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = super.hashCode();
    result = prime * result + ((hash == null) ? 0 : hash.hashCode());
    result = prime * result + ((login == null) ? 0 : login.hashCode());
    result = prime * result + Arrays.hashCode(password);
    result = prime * result + ((roles == null) ? 0 : roles.hashCode());
    return result;
}

From source file:de.mpg.imeji.test.logic.storage.StorageTest.java

/**
 * Do upload - read - delete methods in a row
 * //from  ww  w  .  ja va2s .  c o m
 * @param filename
 * @throws ImejiException
 */
private synchronized void uploadReadDelete(String filename) {
    StorageController sc = new StorageController("internal");
    InternalStorageManager manager = new InternalStorageManager();
    // UPLOAD
    File file = ImejiTestResources.getTestPng();
    try {
        UploadResult res = sc.upload(filename, file, "1");
        Assert.assertFalse(res.getOrginal() + " url is same as path",
                res.getOrginal().equals(manager.transformUrlToPath(res.getOrginal())));
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        // READ THE URL
        sc.read(res.getOrginal(), baos, true);
        baos.toByteArray();
        byte[] stored = baos.toByteArray();
        try {
            // Test if the uploaded file is the (i.e has the same hashcode) the
            // one which has been stored
            Assert.assertTrue("Uploaded file has been modified",
                    Arrays.hashCode(FileUtils.readFileToByteArray(file)) == Arrays.hashCode(stored));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        // DELETE THE FILE
        long before = manager.getAdministrator().getNumberOfFiles();
        sc.delete(res.getId());
        long after = manager.getAdministrator().getNumberOfFiles();
        // Test that the file has been correctly deleted (i.e, the number of
        // files in the storage is null)
        Assert.assertEquals(before - 1, after);
        // Assert.assertTrue(Arrays.equals(original, stored));
        // Assert.assertTrue(Arrays.hashCode(original) ==
        // Arrays.hashCode(stored));
    } catch (ImejiException e) {
        LOGGER.info("There has been some upload error in the storage test.");
    }
}