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:$output.java

@Override
public boolean equals(Object other) {
    return this == other || (other instanceof $output.currentClass && hashCode() == other.hashCode());
}

From source file:WeakCanonicalSet.java

protected int hashCode(Object obj) {
    return obj.hashCode();
}

From source file:com.wickettraining.modelproxy.ProxyManager.java

protected String createUniqueID(Object object) {
    return object.getClass().getSimpleName() + "--" + object.hashCode();
}

From source file:org.axway.grapes.commons.datamodel.Artifact.java

/**
 * Checks if the artifact is the same than an other one.
 *
 * @param obj Object/*from   ww w  . j  a  v a2 s . c  om*/
 * @return <tt>true</tt> only if grId/arId/classifier/version are the same in both.
 */
@Override
public boolean equals(final Object obj) {
    if (obj instanceof Artifact) {
        return hashCode() == obj.hashCode();
    }

    return false;
}

From source file:org.springframework.nanotrader.quote.Quote.java

@Override
public boolean equals(Object o) {
    if (o == null || !(o instanceof Quote)) {
        return false;
    }/*from   w w  w  . j  a v  a  2 s . co  m*/
    return o.hashCode() == hashCode();
}

From source file:uk.codingbadgers.SurvivalPlus.message.Message.java

@Override
public boolean equals(Object obj) {
    return obj instanceof Message && obj.hashCode() == hashCode();
}

From source file:com.jaeksoft.searchlib.util.Debug.java

public void setInfo(Object object) {
    if (object != null) {
        this.className = object.getClass().getCanonicalName();
        this.info = object.toString();
        this.hc = object.hashCode();
    }//from   w  ww  . jav a 2s .c o m
    this.elapsedTime = System.currentTimeMillis() - startTime;
}

From source file:org.knime.knip.base.data.ObjectRepository.java

/**
 * Caches an object. Can be retrieved by {@link #getCachedObject(MemoryReleasable)}, if not deleted.
 *
 * @param obj/* ww  w  .j  a  va  2 s .  c o  m*/
 */
@SuppressWarnings("javadoc")
public final void cacheObject(final Object obj) {
    synchronized (CACHED_OBJECTS) {
        final SoftReference<Object> ref = new SoftReference<Object>(obj);
        CACHED_OBJECTS.put(obj.hashCode(), ref);
        ref.get();
        LOGGER.debug("Cached another object!");
    }

}

From source file:org.openanzo.rdf.Statement.java

@Override
public boolean equals(Object other) {
    if (!(other instanceof Statement))
        return false;
    if (hashCode() == other.hashCode()) {
        Statement otherStmt = (Statement) other;
        if (this.namedGraphUri != null && otherStmt.namedGraphUri != null) {
            if (!this.namedGraphUri.equals(otherStmt.namedGraphUri))
                return false;
        }/*from   w  w  w  .  ja va  2s .  co  m*/
        return super.equals(other);
    } else {
        return false;
    }
}

From source file:com.sunney.service.impl.KafkaServiceImpl.java

/**
 * ??//ww  w.j  a va 2s .c  o m
 * 
 * @param key KEY
 * @param numPartitions 
 * @return
 */
private int partition(Object key, int numPartitions) {
    try {
        long partitionNum = Long.parseLong((String) key);
        return (int) Math.abs(partitionNum % numPartitions);
    } catch (Exception e) {
        return Math.abs(key.hashCode() % numPartitions);
    }
}