java.util.Arrays.hashCode()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(155)

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

Arrays.hashCode介绍

[英]Returns a hash code based on the contents of the given array. For any two byte arrays a and b, if Arrays.equals(a, b) returns true, it means that the return value of Arrays.hashCode(a) equals Arrays.hashCode(b).

The value returned by this method is the same value as the List#hashCode() method which is invoked on a Listcontaining a sequence of Byte instances representing the elements of array in the same order. If the array is null, the return value is 0.
[中]基于给定数组的内容返回哈希代码。对于任意两字节数组a和b,如果是数组。equals(a,b)返回true,这意味着数组的返回值为。hashCode(a)等于数组。hashCode(b)。
此方法返回的值与List#hashCode()方法的值相同,该方法在包含以相同顺序表示数组元素的字节实例序列的列表上调用。如果数组为null,则返回值为0。

代码示例

代码示例来源:origin: square/okhttp

@Override public int hashCode() {
 int result = 17;
 if (tls) {
  result = 31 * result + Arrays.hashCode(cipherSuites);
  result = 31 * result + Arrays.hashCode(tlsVersions);
  result = 31 * result + (supportsTlsExtensions ? 0 : 1);
 }
 return result;
}

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

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

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

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

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

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

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

@Override
public int hashCode() {
  return Arrays.hashCode(this.annotations);
}

代码示例来源:origin: square/okhttp

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

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

public int hashCode () {
  final int prime = 31;
  int result = 1;
  result = prime + length;
  result = prime * result + Arrays.hashCode(chars);
  return result;
}

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

public int hashCode () {
  final int prime = 31;
  int result = 1;
  result = prime + length;
  result = prime * result + Arrays.hashCode(chars);
  return result;
}

代码示例来源:origin: skylot/jadx

public UnknownArg(PrimitiveType[] types) {
  this.possibleTypes = types;
  this.hash = Arrays.hashCode(possibleTypes);
}

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

/**
 * Generate a unique hash code for all properties of this
 * {@code ContextConfigurationAttributes} instance excluding the
 * {@linkplain #getName() name}.
 */
@Override
public int hashCode() {
  int result = this.declaringClass.hashCode();
  result = 31 * result + Arrays.hashCode(this.classes);
  result = 31 * result + Arrays.hashCode(this.locations);
  result = 31 * result + Arrays.hashCode(this.initializers);
  return result;
}

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

@Override
  public int hashCode() {
    return (this.engineName.hashCode() * 29 + Arrays.hashCode(this.scripts));
  }
}

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

@Override
public int hashCode() {
  return (this.rawType.hashCode() * 31 + Arrays.hashCode(this.typeArguments));
}

代码示例来源:origin: square/retrofit

@Override public int hashCode() {
 return Arrays.hashCode(typeArguments)
   ^ rawType.hashCode()
   ^ (ownerType != null ? ownerType.hashCode() : 0);
}

代码示例来源:origin: skylot/jadx

public GenericObject(String obj, ArgType[] generics) {
  super(obj);
  this.outerType = null;
  this.generics = generics;
  this.hash = obj.hashCode() + 31 * Arrays.hashCode(generics);
}

代码示例来源:origin: alibaba/fastjson

@Override
  public int hashCode() {
    int result = actualTypeArguments != null ? Arrays.hashCode(actualTypeArguments) : 0;
    result = 31 * result + (ownerType != null ? ownerType.hashCode() : 0);
    result = 31 * result + (rawType != null ? rawType.hashCode() : 0);
    return result;
  }
}

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

@Override
 public int hashCode() {
  // TODO(lowasser): avoid allocation here
  return Arrays.hashCode(toPlainArray(data));
 }
}

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

@Override
public int hashCode() {
 return name.hashCode()
   ^ Integer.rotateLeft(descriptor.hashCode(), 8)
   ^ Integer.rotateLeft(bootstrapMethod.hashCode(), 16)
   ^ Integer.rotateLeft(Arrays.hashCode(bootstrapMethodArguments), 24);
}

代码示例来源:origin: skylot/jadx

public GenericObject(GenericObject outerType, String innerName, ArgType[] generics) {
  super(outerType.getObject() + "$" + innerName);
  this.outerType = outerType;
  this.generics = generics;
  this.hash = outerType.hashCode() + 31 * innerName.hashCode()
      + 31 * 31 * Arrays.hashCode(generics);
}

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

@Override
  public int hashCode() {
    int result = Objects.hash(getName(), getReturnType(), getParameters());
    result = 31 * result + Arrays.hashCode(getParameterTypes());
    return result;
  }
}

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

@Override
  public int hashCode() {
    int result = Objects.hash(getName(), getReturnType(), getParameters());
    result = 31 * result + Arrays.hashCode(getParameterTypes());
    return result;
  }
}

相关文章