io.airlift.slice.Slice.hashCode()方法的使用及代码示例

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

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

Slice.hashCode介绍

[英]Returns the hash code of this slice. The hash code is cached once calculated and any future changes to the slice will not effect the hash code.
[中]返回此切片的哈希代码。哈希代码在计算后会被缓存,将来对切片的任何更改都不会影响哈希代码。

代码示例

代码示例来源:origin: prestodb/presto

  1. @Override
  2. public int hashCode()
  3. {
  4. return value.hashCode();
  5. }
  6. }

代码示例来源:origin: confluentinc/ksql

  1. @Override
  2. public int hashCode() {
  3. return value.hashCode();
  4. }
  5. }

代码示例来源:origin: prestodb/presto

  1. @ScalarOperator(HASH_CODE)
  2. @SqlType(BIGINT)
  3. public static long hashCode(@SqlType(JSON) Slice value)
  4. {
  5. return value.hashCode();
  6. }

代码示例来源:origin: stanford-futuredata/macrobase

  1. @Override
  2. public int hashCode() {
  3. return value.hashCode();
  4. }
  5. }

代码示例来源:origin: io.prestosql/presto-parser

  1. @Override
  2. public int hashCode()
  3. {
  4. return value.hashCode();
  5. }
  6. }

代码示例来源:origin: com.facebook.presto/presto-parser

  1. @Override
  2. public int hashCode()
  3. {
  4. return value.hashCode();
  5. }
  6. }

代码示例来源:origin: uk.co.nichesolutions.presto/presto-parser

  1. @Override
  2. public int hashCode()
  3. {
  4. return value.hashCode();
  5. }
  6. }

代码示例来源:origin: prestosql/presto

  1. @Override
  2. public int hashCode()
  3. {
  4. return value.hashCode();
  5. }
  6. }

代码示例来源:origin: airlift/slice

  1. /**
  2. * Returns the hash code of this slice. The hash code is cached once calculated
  3. * and any future changes to the slice will not effect the hash code.
  4. */
  5. @SuppressWarnings("NonFinalFieldReferencedInHashCode")
  6. @Override
  7. public int hashCode()
  8. {
  9. if (hash != 0) {
  10. return hash;
  11. }
  12. hash = hashCode(0, size);
  13. return hash;
  14. }

代码示例来源:origin: io.airlift/slice

  1. /**
  2. * Returns the hash code of this slice. The hash code is cached once calculated
  3. * and any future changes to the slice will not effect the hash code.
  4. */
  5. @SuppressWarnings("NonFinalFieldReferencedInHashCode")
  6. @Override
  7. public int hashCode()
  8. {
  9. if (hash != 0) {
  10. return hash;
  11. }
  12. hash = hashCode(0, size);
  13. return hash;
  14. }

代码示例来源:origin: prestosql/presto

  1. @ScalarOperator(HASH_CODE)
  2. @SqlType(BIGINT)
  3. public static long hashCode(@SqlType(JSON) Slice value)
  4. {
  5. return value.hashCode();
  6. }

代码示例来源:origin: io.prestosql/presto-main

  1. @ScalarOperator(HASH_CODE)
  2. @SqlType(BIGINT)
  3. public static long hashCode(@SqlType(JSON) Slice value)
  4. {
  5. return value.hashCode();
  6. }

代码示例来源:origin: uk.co.nichesolutions.presto/presto-main

  1. @ScalarOperator(HASH_CODE)
  2. @SqlType(BIGINT)
  3. public static long hashCode(@SqlType(JSON) Slice value)
  4. {
  5. return value.hashCode();
  6. }

代码示例来源:origin: uk.co.nichesolutions.presto/presto-main

  1. @ScalarOperator(HASH_CODE)
  2. @SqlType(StandardTypes.BIGINT)
  3. public static long hashCode(@SqlType(StandardTypes.VARBINARY) Slice value)
  4. {
  5. return value.hashCode();
  6. }
  7. }

代码示例来源:origin: airlift/slice

  1. private static void assertSlicesEquals(Slice slice, Slice other)
  2. {
  3. int size = slice.length();
  4. assertEquals(slice, other);
  5. assertTrue(slice.equals(0, size, other, 0, size));
  6. assertEquals(slice.hashCode(), other.hashCode());
  7. assertEquals(slice.hashCode(), other.hashCode(0, size));
  8. assertEquals(slice.compareTo(other), 0);
  9. assertEquals(slice.compareTo(0, size, other, 0, size), 0);
  10. for (int i = 0; i < slice.length(); i++) {
  11. assertTrue(slice.equals(i, size - i, other, i, size - i));
  12. assertEquals(slice.hashCode(i, size - i), other.hashCode(i, size - i));
  13. assertEquals(slice.compareTo(i, size - i, other, i, size - i), 0);
  14. }
  15. for (int i = 0; i < slice.length(); i++) {
  16. assertTrue(slice.equals(0, size - i, other, 0, size - i));
  17. assertEquals(slice.hashCode(0, size - i), other.hashCode(0, size - i));
  18. assertEquals(slice.compareTo(0, size - i, other, 0, size - i), 0);
  19. }
  20. }

代码示例来源:origin: uk.co.nichesolutions.presto/presto-main

  1. @LiteralParameters("x")
  2. @ScalarOperator(HASH_CODE)
  3. @SqlType(StandardTypes.BIGINT)
  4. public static long hashCode(@SqlType("varchar(x)") Slice value)
  5. {
  6. return value.hashCode();
  7. }
  8. }

代码示例来源:origin: io.airlift/slice

  1. private static void assertSlicesEquals(Slice slice, Slice other)
  2. {
  3. int size = slice.length();
  4. assertEquals(slice, other);
  5. assertTrue(slice.equals(0, size, other, 0, size));
  6. assertEquals(slice.hashCode(), other.hashCode());
  7. assertEquals(slice.hashCode(), other.hashCode(0, size));
  8. assertEquals(slice.compareTo(other), 0);
  9. assertEquals(slice.compareTo(0, size, other, 0, size), 0);
  10. for (int i = 0; i < slice.length(); i++) {
  11. assertTrue(slice.equals(i, size - i, other, i, size - i));
  12. assertEquals(slice.hashCode(i, size - i), other.hashCode(i, size - i));
  13. assertEquals(slice.compareTo(i, size - i, other, i, size - i), 0);
  14. }
  15. for (int i = 0; i < slice.length(); i++) {
  16. assertTrue(slice.equals(0, size - i, other, 0, size - i));
  17. assertEquals(slice.hashCode(0, size - i), other.hashCode(0, size - i));
  18. assertEquals(slice.compareTo(0, size - i, other, 0, size - i), 0);
  19. }
  20. }

代码示例来源:origin: airlift/slice

  1. @Benchmark
  2. public long hash(BenchmarkData data, ByteCounter counter)
  3. {
  4. counter.add(data.getSlice().length());
  5. return data.getSlice().hashCode(0, data.getSlice().length());
  6. }

代码示例来源:origin: io.airlift/slice

  1. @Benchmark
  2. public long hash(BenchmarkData data, ByteCounter counter)
  3. {
  4. counter.add(data.getSlice().length());
  5. return data.getSlice().hashCode(0, data.getSlice().length());
  6. }

代码示例来源:origin: uk.co.nichesolutions.presto/presto-main

  1. assertEquals(block.hash(position, offset, 3), expectedSliceValue.hashCode(offset, 3));
  2. assertTrue(block.bytesEqual(position, offset, expectedSliceValue, offset, 3));

相关文章