java.lang.System.identityHashCode()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(210)

本文整理了Java中java.lang.System.identityHashCode()方法的一些代码示例,展示了System.identityHashCode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。System.identityHashCode()方法的具体详情如下:
包路径:java.lang.System
类名称:System
方法名:identityHashCode

System.identityHashCode介绍

[英]Returns an integer hash code for the parameter. The hash code returned is the same one that would be returned by the method java.lang.Object.hashCode(), whether or not the object's class has overridden hashCode(). The hash code for null is 0.
[中]返回参数的整数哈希代码。返回的哈希代码与java方法返回的哈希代码相同。lang.Object。hashCode(),无论对象的类是否已重写hashCode()。null的哈希代码为0。

代码示例

代码示例来源:origin: spring-projects/spring-framework

/**
  * Returns a string representation of this label.
  *
  * @return a string representation of this label.
  */
 @Override
 public String toString() {
  return "L" + System.identityHashCode(this);
 }
}

代码示例来源:origin: google/guava

@Override
public int hashCode() {
 return System.identityHashCode(this);
}

代码示例来源:origin: google/guava

@Override
protected int doHash(Object o) {
 return System.identityHashCode(o);
}

代码示例来源:origin: google/guava

int identityHashCode(Object object) {
  return System.identityHashCode(object);
 }
}

代码示例来源:origin: google/guava

@Override
public int hashCode() {
 return System.identityHashCode(this);
}

代码示例来源:origin: apache/incubator-dubbo

private static String getServerSideCallbackServiceCacheKey(Channel channel, String interfaceClass, int instid) {
  return Constants.CALLBACK_SERVICE_PROXY_KEY + "." + System.identityHashCode(channel) + "." + interfaceClass + "." + instid;
}

代码示例来源:origin: apache/incubator-dubbo

private static String getServerSideCountKey(Channel channel, String interfaceClass) {
  return Constants.CALLBACK_SERVICE_PROXY_KEY + "." + System.identityHashCode(channel) + "." + interfaceClass + ".COUNT";
}

代码示例来源:origin: apache/incubator-dubbo

private static String getServerSideCountKey(Channel channel, String interfaceClass) {
  return Constants.CALLBACK_SERVICE_PROXY_KEY + "." + System.identityHashCode(channel) + "." + interfaceClass + ".COUNT";
}

代码示例来源:origin: apache/incubator-dubbo

private static String getServerSideCallbackServiceCacheKey(Channel channel, String interfaceClass, int instid) {
  return Constants.CALLBACK_SERVICE_PROXY_KEY + "." + System.identityHashCode(channel) + "." + interfaceClass + "." + instid;
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * Return a hex String form of an object's identity hash code.
 * @param obj the object
 * @return the object's identity code in hex notation
 */
public static String getIdentityHexString(Object obj) {
  return Integer.toHexString(System.identityHashCode(obj));
}

代码示例来源:origin: google/guava

@Override
public final int hashCode() {
 return (31 + method.hashCode()) * 31 + System.identityHashCode(target);
}

代码示例来源:origin: apache/incubator-dubbo

public static String toShortString(Object obj) {
  if (obj == null) {
    return "null";
  }
  return obj.getClass().getSimpleName() + "@" + System.identityHashCode(obj);
}

代码示例来源:origin: apache/incubator-dubbo

public static String toShortString(Object obj) {
  if (obj == null) {
    return "null";
  }
  return obj.getClass().getSimpleName() + "@" + System.identityHashCode(obj);
}

代码示例来源:origin: spring-projects/spring-framework

@Override
  public int hashCode() {
    return System.identityHashCode(this);
  }
};

代码示例来源:origin: spring-projects/spring-framework

/**
 * Return the description for the given Resource; if the description is
 * empty, return the class name of the resource plus its identity hash code.
 * @see org.springframework.core.io.Resource#getDescription()
 */
private static String getNameForResource(Resource resource) {
  String name = resource.getDescription();
  if (!StringUtils.hasText(name)) {
    name = resource.getClass().getSimpleName() + "@" + System.identityHashCode(resource);
  }
  return name;
}

代码示例来源:origin: google/guava

@Override
public int hashCode() {
 return System.identityHashCode(s);
}

代码示例来源:origin: google/guava

private static String lenientToString(@Nullable Object o) {
  try {
   return String.valueOf(o);
  } catch (Exception e) {
   // Default toString() behavior - see Object.toString()
   String objectToString =
     o.getClass().getName() + '@' + Integer.toHexString(System.identityHashCode(o));
   // Logger is created inline with fixed name to avoid forcing Proguard to create another class.
   Logger.getLogger("com.google.common.base.Strings")
     .log(WARNING, "Exception during lenientFormat for " + objectToString, e);
   return "<" + objectToString + " threw " + e.getClass().getName() + ">";
  }
 }
}

代码示例来源:origin: netty/netty

@Override
public int compareTo(ChannelGroup o) {
  int v = name().compareTo(o.name());
  if (v != 0) {
    return v;
  }
  return System.identityHashCode(this) - System.identityHashCode(o);
}

代码示例来源:origin: apache/incubator-dubbo

@SuppressWarnings("unchecked")
@Override
protected <T> Invoker<T> doSelect(List<Invoker<T>> invokers, URL url, Invocation invocation) {
  String methodName = RpcUtils.getMethodName(invocation);
  String key = invokers.get(0).getUrl().getServiceKey() + "." + methodName;
  int identityHashCode = System.identityHashCode(invokers);
  ConsistentHashSelector<T> selector = (ConsistentHashSelector<T>) selectors.get(key);
  if (selector == null || selector.identityHashCode != identityHashCode) {
    selectors.put(key, new ConsistentHashSelector<T>(invokers, methodName, identityHashCode));
    selector = (ConsistentHashSelector<T>) selectors.get(key);
  }
  return selector.select(invocation);
}

代码示例来源:origin: apache/incubator-dubbo

@SuppressWarnings("unchecked")
@Override
protected <T> Invoker<T> doSelect(List<Invoker<T>> invokers, URL url, Invocation invocation) {
  String methodName = RpcUtils.getMethodName(invocation);
  String key = invokers.get(0).getUrl().getServiceKey() + "." + methodName;
  int identityHashCode = System.identityHashCode(invokers);
  ConsistentHashSelector<T> selector = (ConsistentHashSelector<T>) selectors.get(key);
  if (selector == null || selector.identityHashCode != identityHashCode) {
    selectors.put(key, new ConsistentHashSelector<T>(invokers, methodName, identityHashCode));
    selector = (ConsistentHashSelector<T>) selectors.get(key);
  }
  return selector.select(invocation);
}

相关文章