Example usage for java.lang Object hashCode

List of usage examples for java.lang Object hashCode

Introduction

In this page you can find the example usage for java.lang Object hashCode.

Prototype

@HotSpotIntrinsicCandidate
public native int hashCode();

Source Link

Document

Returns a hash code value for the object.

Usage

From source file:org.efs.openreports.util.EncryptedStringUserType.java

public int hashCode(Object arg0) throws HibernateException {
    return arg0.hashCode();
}

From source file:FastMap.java

/**
 * Returns the hash code for the specified key. The formula being used 
 * is identical to the formula used by <code>java.util.HashMap</code>
 * (ensures similar behavior for ill-conditioned hashcode keys).
 * //from   w w  w  .  ja va 2  s .c  om
 * @param key the key to calculate the hashcode for.
 * @return the hash code for the specified key.
 */
private static int keyHash(Object key) {
    // From HashMap.hash(Object) function.
    int hashCode = key.hashCode();
    hashCode += ~(hashCode << 9);
    hashCode ^= (hashCode >>> 14);
    hashCode += (hashCode << 4);
    hashCode ^= (hashCode >>> 10);
    return hashCode;
}

From source file:org.podcastpedia.web.caching.EnhancedDefaultKeyGenerator.java

public Object generate(Object target, Method method, Object... params) {
    if (params.length == 1 && isWrapperType(params[0].getClass())) {
        return (params[0] == null ? NULL_PARAM_KEY : params[0]);
    }/*w ww.  j a  v a2 s . c o  m*/
    if (params.length == 0) {
        return NO_PARAM_KEY;
    }
    int hashCode = 17;
    for (Object object : params) {
        hashCode = 31 * hashCode + (object == null ? NULL_PARAM_KEY : object.hashCode());
    }
    return Integer.valueOf(hashCode);
}

From source file:org.springframework.nanotrader.order.Holding.java

public boolean equals(Object o) {
    return o != null && o instanceof Holding && o.hashCode() == hashCode();
}

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

/**
 * @param contents can be <code>null</code> and can contain <code>null</code> elements.
 *//*from   ww w.  j av a 2s  . co  m*/
public Key(Object... contents) {
    this.contents = contents;
    if (contents != null && contents.length != 0) {
        for (Object content : contents) {
            hashCode = hashCode * CONSTANT + (content == null ? NULL_HASH_CODE : content.hashCode());
        }
    } else {
        hashCode = hashCode * CONSTANT + NULL_HASH_CODE;
    }
}

From source file:org.openmrs.module.amrsreports.db.hibernate.type.MohStringEnumType.java

public int hashCode(final Object x) throws HibernateException {
    return x.hashCode();
}

From source file:de.innovationgate.wgaservices.types.FormField.java

@Override
public boolean equals(Object obj) {
    if (obj == null) {
        return false;
    } else {/* w  w w . j  a v a2 s . c  o  m*/
        return obj.hashCode() == hashCode();
    }
}

From source file:org.jboss.dashboard.database.hibernate.BinaryBlobType.java

public int hashCode(Object o) throws HibernateException {
    return o == null ? 0 : o.hashCode();
}

From source file:com.opengamma.masterdb.security.hibernate.EnumUserType.java

@Override
public int hashCode(Object arg0) throws HibernateException {
    return arg0.hashCode();
}

From source file:org.sakaiproject.metaobj.shared.IdType.java

public int hashCode(Object value) throws HibernateException {
    return value.hashCode();
}