org.assertj.core.util.Objects.hashCodeFor()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(113)

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

Objects.hashCodeFor介绍

[英]Returns the hash code for the given object. If the object is null, this method returns zero. Otherwise calls the method hashCode of the given object.
[中]返回给定对象的哈希代码。如果对象为null,则此方法返回零。否则调用给定对象的hashCode方法。

代码示例

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

  1. @Override
  2. public int hashCode() {
  3. int result = 1;
  4. result = HASH_CODE_PRIME * result + hashCodeFor(actual);
  5. result = HASH_CODE_PRIME * result + hashCodeFor(expected);
  6. return result;
  7. }

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

  1. @Override
  2. public int hashCode() {
  3. return HASH_CODE_PRIME * hashCodeFor(description);
  4. }
  5. }

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

  1. @Override
  2. public int hashCode() {
  3. int result = 1;
  4. result = HASH_CODE_PRIME * result + hashCodeFor(value);
  5. return result;
  6. }

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

  1. @Override
  2. public int hashCode() {
  3. return HASH_CODE_PRIME + hashCodeFor(value) + hashCodeFor(args);
  4. }

代码示例来源:origin: joel-costigliola/assertj-core

  1. @Override
  2. public int hashCode() {
  3. return HASH_CODE_PRIME * hashCodeFor(description);
  4. }
  5. }

代码示例来源:origin: joel-costigliola/assertj-core

  1. @Override
  2. public int hashCode() {
  3. int result = 1;
  4. result = HASH_CODE_PRIME * result + hashCodeFor(value);
  5. return result;
  6. }

代码示例来源:origin: joel-costigliola/assertj-core

  1. @Override
  2. public int hashCode() {
  3. int result = 1;
  4. result = HASH_CODE_PRIME * result + hashCodeFor(actual);
  5. result = HASH_CODE_PRIME * result + hashCodeFor(expected);
  6. return result;
  7. }

代码示例来源:origin: joel-costigliola/assertj-core

  1. @Override
  2. public int hashCode() {
  3. return HASH_CODE_PRIME + hashCodeFor(value) + hashCodeFor(args);
  4. }

代码示例来源:origin: square/assertj-android

  1. @Override public int hashCode() {
  2. int result = 1;
  3. result = HASH_CODE_PRIME * result + hashCodeFor(key);
  4. result = HASH_CODE_PRIME * result + hashCodeFor(value);
  5. return result;
  6. }

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

  1. @Override
  2. public int hashCode() {
  3. int result = 1;
  4. result = HASH_CODE_PRIME * result + hashCodeFor(format);
  5. result = HASH_CODE_PRIME * result + Arrays.hashCode(arguments);
  6. return result;
  7. }

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

  1. @Override
  2. protected Set<Object> newSetUsingComparisonStrategy() {
  3. // define a comparator so that we can use areEqual to compare objects in Set collections
  4. // the "less than" comparison does not make much sense here but need to be defined.
  5. return new TreeSet<>((o1, o2) -> {
  6. if (areEqual(o1, o2)) return 0;
  7. return Objects.hashCodeFor(o1) < Objects.hashCodeFor(o2) ? -1 : 1;
  8. });
  9. }

代码示例来源:origin: joel-costigliola/assertj-core

  1. @Override
  2. public int hashCode() {
  3. int result = 1;
  4. result = HASH_CODE_PRIME * result + hashCodeFor(format);
  5. result = HASH_CODE_PRIME * result + Arrays.hashCode(arguments);
  6. return result;
  7. }

代码示例来源:origin: joel-costigliola/assertj-core

  1. @Override
  2. protected Set<Object> newSetUsingComparisonStrategy() {
  3. // define a comparator so that we can use areEqual to compare objects in Set collections
  4. // the "less than" comparison does not make much sense here but need to be defined.
  5. return new TreeSet<>((o1, o2) -> {
  6. if (areEqual(o1, o2)) return 0;
  7. return Objects.hashCodeFor(o1) < Objects.hashCodeFor(o2) ? -1 : 1;
  8. });
  9. }

代码示例来源:origin: org.assertj/assertj-guava

  1. @Override
  2. public int hashCode() {
  3. int result = 1;
  4. result = HASH_CODE_PRIME * result + hashCodeFor(key);
  5. result = HASH_CODE_PRIME * result + hashCodeFor(value);
  6. return result;
  7. }

代码示例来源:origin: org.assertj/assertj-swing-junit

  1. /**
  2. * Returns the hash code of this attribute, based on its name and value.
  3. *
  4. * @return the hash code of this attribute.
  5. */
  6. @Override
  7. public int hashCode() {
  8. int result = 1;
  9. result = HASH_CODE_PRIME * result + hashCodeFor(name);
  10. result = HASH_CODE_PRIME * result + hashCodeFor(value);
  11. return result;
  12. }

代码示例来源:origin: joel-costigliola/assertj-swing

  1. @Override
  2. public int hashCode() {
  3. int result = 1;
  4. result = HASH_CODE_PRIME * result + hashCodeFor(attributes);
  5. return result;
  6. }

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

  1. @Override
  2. public int hashCode() {
  3. int result = 1;
  4. result = HASH_CODE_PRIME * result + hashCodeFor(value);
  5. return result;
  6. }

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

  1. @Override
  2. public int hashCode() {
  3. int result = 1;
  4. result = HASH_CODE_PRIME * result + hashCodeFor(key);
  5. result = HASH_CODE_PRIME * result + hashCodeFor(value);
  6. return result;
  7. }

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

  1. @Override
  2. public int hashCode() {
  3. int result = 1;
  4. result = HASH_CODE_PRIME * result + hashCodeFor(format);
  5. result = HASH_CODE_PRIME * result + Arrays.hashCode(arguments);
  6. return result;
  7. }

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

  1. @Override
  2. public int compare(Object o1, Object o2) {
  3. if (areEqual(o1, o2)) return 0;
  4. return Objects.hashCodeFor(o1) < Objects.hashCodeFor(o2) ? -1 : 1;
  5. }
  6. });

相关文章