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:it.unibas.spicy.persistence.object.operators.GenerateObjectInstance.java

private void putObject(Object object, INode tupleNode) {
    if (objectMap.get(object.hashCode()) == null) {
        if (logger.isDebugEnabled())
            logger.debug("Adding object in map: " + object);
        objectMap.put(object.hashCode(), tupleNode);
    }/*from   ww  w. j  a va  2s .  com*/
}

From source file:ConcurrentHashMap.java

/**
 * Return hash code for Object x. Since we are using power-of-two tables, it
 * is worth the effort to improve hashcode via the same multiplicative
 * scheme as used in IdentityHashMap./*from   ww w. ja v a  2 s  . c o  m*/
 * @param x 
 * @return hash code
 */
protected static int hash(Object x) {
    int h = x.hashCode();
    // Multiply by 127 (quickly, via shifts), and mix in some high
    // bits to help guard against bunching of codes that are
    // consecutive or equally spaced.
    return ((h << 7) - h + (h >>> 9) + (h >>> 17));
}

From source file:org.lightjason.trafficsimulation.simulation.IBaseObject.java

@Override
public final boolean equals(final Object p_object) {
    return (p_object != null) && (p_object instanceof IObject<?>) && (this.hashCode() == p_object.hashCode());
}

From source file:org.apache.hadoop.ipc.CallQueueManager.java

private String stringRepr(Object o) {
    return o.getClass().getName() + '@' + Integer.toHexString(o.hashCode());
}

From source file:org.apache.usergrid.chop.webapp.coordinator.SetupStackThread.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }//from  ww  w. j  a v  a2 s .  co  m
    return obj != null && obj instanceof SetupStackThread && obj.hashCode() == this.hashCode();
}

From source file:com.cloudera.crunch.Pair.java

private int cmp(Object lhs, Object rhs) {
    if (lhs == rhs) {
        return 0;
    } else if (lhs != null && Comparable.class.isAssignableFrom(lhs.getClass())) {
        return ((Comparable) lhs).compareTo(rhs);
    }//from www.j a v  a  2  s  .c o  m
    return (lhs == null ? 0 : lhs.hashCode()) - (rhs == null ? 0 : rhs.hashCode());
}

From source file:org.apache.xmlgraphics.ps.PSDictionary.java

/** {@inheritDoc} */
@Override// w  w w  .  j av  a2s  . c o m
public int hashCode() {
    int hashCode = 7;
    for (final Object value : values()) {
        hashCode += value.hashCode();
    }
    return hashCode;
}

From source file:BucketizedHashtable.java

/**
 * @param key//from w  ww  . j a v  a  2 s  .co  m
 * @return the bucket index for the specified key
 */
private int getBucketIndex(Object key) {
    int index = key.hashCode() % bucketSize;
    return (index >= 0) ? index : index + bucketSize;
}

From source file:org.openspaces.remoting.ExecutorRemotingTask.java

void setRouting(Object routing) {
    this.routing = routing.hashCode();
}

From source file:motej.Mote.java

@Override
public boolean equals(Object obj) {
    if (!(obj instanceof Mote))
        return false;

    return hashCode() == obj.hashCode();
}