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:com.eventsourcing.layout.types.ByteArrayTypeHandler.java

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

From source file:com.anrisoftware.prefdialog.miscswing.statusbar.StatusBarItem.java

protected StatusBarItem(Object message) {
    this.message = message == null ? 0 : message.hashCode();
    this.time = System.currentTimeMillis();
}

From source file:cz.lbenda.rcp.config.ConfigurationFileProvider.java

@Override
public int compareTo(@Nonnull Object o) {
    int h1 = hashCode();
    int h2 = o.hashCode();
    if (h1 < h2) {
        return -1;
    }//from   ww w.j  a  v  a  2s .c  o  m
    if (h1 > h2) {
        return 1;
    }
    return 0;
}

From source file:org.ambraproject.hibernate.URLType.java

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

From source file:com.helpinput.core.Utils.java

public static void printObject(Object o) {
    StringBuffer sb = new StringBuffer();
    Class<?> targetClass = null;
    if (o != null)
        targetClass = o.getClass();/*from ww w  . j a  v  a2s.  c om*/
    else {
        logger.info("" + null);
        return;
    }
    sb.append("class:" + o.getClass() + "@" + o.hashCode() + ";\n");
    object2Buffer(o, targetClass, sb);
    logger.info(sb.toString());
}

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

public void sendUserInfo(String topic, Object obj) {
    // ?messageKey
    String messageKey = String.valueOf(obj.hashCode());
    // ??//from w w w . j av  a 2 s  . c  o m
    int partitionId = partition(messageKey, numPartitions);
    channel.send(MessageBuilder.withPayload(obj).setHeader(KafkaHeaders.TOPIC, topic)
            .setHeader(KafkaHeaders.MESSAGE_KEY, messageKey).setHeader(KafkaHeaders.PARTITION_ID, partitionId)
            .build());
}

From source file:org.hsweb.concureent.cache.SimpleKeyGenerator.java

@Override
public Object generate(Object target, Method method, Object... params) {
    StringBuilder sb = new StringBuilder();
    sb.append(target.getClass().getName());
    sb.append(method.getName());//from  ww w.j av a 2 s .  c  o  m
    for (Object obj : params) {
        if (obj == null)
            obj = "null";
        sb.append(obj.hashCode());
    }
    return sb.toString();
}

From source file:com.jabyftw.lobstercraft.world.ChunkLocation.java

@Override
public int compareTo(Object o) {
    return hashCode() - o.hashCode();
}

From source file:org.sonar.graph.FeedbackEdge.java

@Override
public boolean equals(Object obj) {
    if (!(obj instanceof FeedbackEdge) || this.hashCode() != obj.hashCode()) {
        return false;
    }/*ww  w .j a v a2  s.c om*/
    FeedbackEdge otherEdge = (FeedbackEdge) obj;
    return edge.equals(otherEdge.edge);
}

From source file:org.slc.sli.dashboard.util.UserCacheKeyGenerator.java

@Override
public Object generate(Object target, Method method, Object... params) {

    String token = SecurityUtil.getToken();

    int hashCode = 17;
    hashCode = 31 * hashCode + (token == null ? NULL_PARAM_KEY : token.hashCode());
    hashCode = 31 * hashCode + method.getDeclaringClass().hashCode();
    hashCode = 31 * hashCode + method.getName().hashCode();

    for (Object object : params) {
        hashCode = 31 * hashCode + (object == null ? NULL_PARAM_KEY : object.hashCode());
    }//from   w  w  w  .  j  a v  a 2  s .  c om
    return Integer.valueOf(hashCode);
}