本文整理了Java中org.apache.hadoop.hbase.KeyValue.hashCode()
方法的一些代码示例,展示了KeyValue.hashCode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。KeyValue.hashCode()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.KeyValue
类名称:KeyValue
方法名:hashCode
[英]In line with #equals(Object), only uses the key portion, not the value.
[中]与#equals(Object)一致,只使用键部分,而不使用值。
代码示例来源:origin: apache/hbase
@Override
public int hashCode() {
return super.hashCode();
}
代码示例来源:origin: apache/hbase
@Test
public void testEqualsAndHashCode() throws Exception {
KeyValue kvA1 = new KeyValue(Bytes.toBytes("key"), Bytes.toBytes("cf"),
Bytes.toBytes("qualA"), Bytes.toBytes("1"));
KeyValue kvA2 = new KeyValue(Bytes.toBytes("key"), Bytes.toBytes("cf"),
Bytes.toBytes("qualA"), Bytes.toBytes("2"));
// We set a different sequence id on kvA2 to demonstrate that the equals and hashCode also
// don't take this into account.
kvA2.setSequenceId(2);
KeyValue kvB = new KeyValue(Bytes.toBytes("key"), Bytes.toBytes("cf"),
Bytes.toBytes("qualB"), Bytes.toBytes("1"));
assertEquals(kvA1, kvA2);
assertNotEquals(kvA1, kvB);
assertEquals(kvA1.hashCode(), kvA2.hashCode());
assertNotEquals(kvA1.hashCode(), kvB.hashCode());
}
代码示例来源:origin: forcedotcom/phoenix
@Override
public int hashCode() {
// TODO do we need to keep the same hashcode logic as KeyValue? Everywhere else we don't keep
// them by reference, but presumably clients might hash them.
final int prime = 31;
int result = super.hashCode();
result = prime * result + family.hashCode();
result = prime * result + qualifier.hashCode();
result = prime * result + row.hashCode();
result = prime * result + (int) (ts ^ (ts >>> 32));
result = prime * result + type.hashCode();
result = prime * result + value.hashCode();
return result;
}
代码示例来源:origin: org.apache.hbase/hbase-common
@Override
public int hashCode() {
return super.hashCode();
}
代码示例来源:origin: com.aliyun.hbase/alihbase-common
@Override
public int hashCode() {
return super.hashCode();
}
代码示例来源:origin: harbby/presto-connectors
@Override
public int hashCode() {
return super.hashCode();
}
代码示例来源:origin: com.aliyun.hbase/alihbase-common
public void testEqualsAndHashCode() throws Exception {
KeyValue kvA1 = new KeyValue(Bytes.toBytes("key"), Bytes.toBytes("cf"),
Bytes.toBytes("qualA"), Bytes.toBytes("1"));
KeyValue kvA2 = new KeyValue(Bytes.toBytes("key"), Bytes.toBytes("cf"),
Bytes.toBytes("qualA"), Bytes.toBytes("2"));
// We set a different sequence id on kvA2 to demonstrate that the equals and hashCode also
// don't take this into account.
kvA2.setSequenceId(2);
KeyValue kvB = new KeyValue(Bytes.toBytes("key"), Bytes.toBytes("cf"),
Bytes.toBytes("qualB"), Bytes.toBytes("1"));
assertEquals(kvA1, kvA2);
assertNotEquals(kvA1, kvB);
assertEquals(kvA1.hashCode(), kvA2.hashCode());
assertNotEquals(kvA1.hashCode(), kvB.hashCode());
}
代码示例来源:origin: org.apache.hbase/hbase-common
@Test
public void testEqualsAndHashCode() throws Exception {
KeyValue kvA1 = new KeyValue(Bytes.toBytes("key"), Bytes.toBytes("cf"),
Bytes.toBytes("qualA"), Bytes.toBytes("1"));
KeyValue kvA2 = new KeyValue(Bytes.toBytes("key"), Bytes.toBytes("cf"),
Bytes.toBytes("qualA"), Bytes.toBytes("2"));
// We set a different sequence id on kvA2 to demonstrate that the equals and hashCode also
// don't take this into account.
kvA2.setSequenceId(2);
KeyValue kvB = new KeyValue(Bytes.toBytes("key"), Bytes.toBytes("cf"),
Bytes.toBytes("qualB"), Bytes.toBytes("1"));
assertEquals(kvA1, kvA2);
assertNotEquals(kvA1, kvB);
assertEquals(kvA1.hashCode(), kvA2.hashCode());
assertNotEquals(kvA1.hashCode(), kvB.hashCode());
}
内容来源于网络,如有侵权,请联系作者删除!