java.lang.Enum.hashCode()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(216)

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

Enum.hashCode介绍

[英]Returns a hash code for this enum constant.
[中]返回此枚举常量的哈希代码。

代码示例

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

@Override
public int hashCode() {
  return enumeration.hashCode();
}

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

@Override
public int hashCode() {
  return (enumMap.keys[ordinal] == null ? 0 : enumMap.keys[ordinal]
      .hashCode())
      ^ (enumMap.values[ordinal] == null ? 0
          : enumMap.values[ordinal].hashCode());
}

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

@Override
default long hash(T object) {
  final E e = apply(object);
  return e == null ? -1 : e.hashCode();
}

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

@Override
default long hash(T object) {
  return apply(object).hashCode();
}

代码示例来源:origin: MorphiaOrg/morphia

@Override
public int hashCode() {
  final int prime = 31;
  int result = 1;
  result = prime * result + ((name == null) ? 0 : name.hashCode());
  result = prime * result + ((value == null) ? 0 : value.hashCode());
  return result;
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public int hashCode()
{
  return this.setting.hashCode() ^ this.value.hashCode();
}

代码示例来源:origin: com.netflix.rxnetty/rx-netty

@Override
  public int hashCode() {
    int result = name.hashCode();
    result = 31 * result + (isTimed ? 1 : 0);
    result = 31 * result + (isError ? 1 : 0);
    return result;
  }
}

代码示例来源:origin: io.reactivex/rxnetty

@Override
  public int hashCode() {
    int result = name.hashCode();
    result = 31 * result + (isTimed ? 1 : 0);
    result = 31 * result + (isError ? 1 : 0);
    return result;
  }
}

代码示例来源:origin: MobiVM/robovm

@Override
public int hashCode() {
  return (enumMap.keys[ordinal] == null ? 0 : enumMap.keys[ordinal]
      .hashCode())
      ^ (enumMap.values[ordinal] == null ? 0
          : enumMap.values[ordinal].hashCode());
}

代码示例来源:origin: ibinti/bugvm

@Override
public int hashCode() {
  return (enumMap.keys[ordinal] == null ? 0 : enumMap.keys[ordinal]
      .hashCode())
      ^ (enumMap.values[ordinal] == null ? 0
          : enumMap.values[ordinal].hashCode());
}

代码示例来源:origin: io.vertx/vertx-jgroups

@Override
 public int hashCode() {
  int result = value.hashCode();
  result = 31 * result + compare.hashCode();
  return result;
 }
}

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

@Override
public int hashCode() {
  final int prime = 31;
  int result = 1;
  result = prime * result + unit.hashCode();
  long temp;
  temp = Double.doubleToLongBits(value);
  result = prime * result + (int) (temp ^ (temp >>> 32));
  return result;
}

代码示例来源:origin: com.bugvm/bugvm-rt

@Override
public int hashCode() {
  return (enumMap.keys[ordinal] == null ? 0 : enumMap.keys[ordinal]
      .hashCode())
      ^ (enumMap.values[ordinal] == null ? 0
          : enumMap.values[ordinal].hashCode());
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

@Override
public int hashCode() {
  return (enumMap.keys[ordinal] == null ? 0 : enumMap.keys[ordinal]
      .hashCode())
      ^ (enumMap.values[ordinal] == null ? 0
          : enumMap.values[ordinal].hashCode());
}

代码示例来源:origin: jclouds/legacy-jclouds

@Override
public int hashCode() {
 final int prime = 31;
 int result = 1;
 result = prime * result + ((id == null) ? 0 : id.hashCode());
 result = prime * result + ((location == null) ? 0 : location.hashCode());
 result = prime * result + ((name == null) ? 0 : name.hashCode());
 result = prime * result + ((type == null) ? 0 : type.hashCode());
 result = prime * result + ((uri == null) ? 0 : uri.hashCode());
 return result;
}

代码示例来源:origin: org.jclouds/jclouds-core

@Override
public int hashCode() {
 final int prime = 31;
 int result = 1;
 result = prime * result + ((id == null) ? 0 : id.hashCode());
 result = prime * result + ((location == null) ? 0 : location.hashCode());
 result = prime * result + ((name == null) ? 0 : name.hashCode());
 result = prime * result + ((type == null) ? 0 : type.hashCode());
 result = prime * result + ((uri == null) ? 0 : uri.hashCode());
 return result;
}

代码示例来源:origin: io.cloudsoft.jclouds/jclouds-core

@Override
public int hashCode() {
 final int prime = 31;
 int result = 1;
 result = prime * result + ((id == null) ? 0 : id.hashCode());
 result = prime * result + ((location == null) ? 0 : location.hashCode());
 result = prime * result + ((name == null) ? 0 : name.hashCode());
 result = prime * result + ((type == null) ? 0 : type.hashCode());
 result = prime * result + ((uri == null) ? 0 : uri.hashCode());
 return result;
}

代码示例来源:origin: cwensel/cascading

@Override
public int hashCode()
 {
 int result = super.hashCode();
 result = 31 * result + ( counterEnum != null ? counterEnum.hashCode() : 0 );
 result = 31 * result + ( groupString != null ? groupString.hashCode() : 0 );
 result = 31 * result + ( counterString != null ? counterString.hashCode() : 0 );
 result = 31 * result + increment;
 return result;
 }
}

代码示例来源:origin: stackoverflow.com

Object[] objs = new Object[5];
for(int i=0;i<objs.length;i++) {
  objs[i] = new Object();
}
RetentionPolicy[] values = RetentionPolicy.values();
System.out.println(objs+": "+objs.hashCode());
for (Object obj : objs) {
  System.out.println(obj+": "+obj.hashCode());
}
for (RetentionPolicy policy : values) {
  System.out.println(policy+": "+policy.hashCode());
}

代码示例来源:origin: org.jvnet.jaxb2_commons/jaxb2-basics-runtime

protected int hashCodeInternal(ObjectLocator locator, int hashCode, Enum<?> value) {
  if (value == null) {
    return hashCode * iConstant;
  } else if (value instanceof HashCode2) {
    return hashCodeInternal(locator, hashCode, (HashCode2) value);
  } else if (value instanceof HashCode) {
    return hashCodeInternal(locator, hashCode, (HashCode) value);
  } else {
    return hashCode * iConstant + value.hashCode();
  }
}

相关文章