本文整理了Java中com.google.protobuf.Internal.hashEnumList()
方法的一些代码示例,展示了Internal.hashEnumList()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Internal.hashEnumList()
方法的具体详情如下:
包路径:com.google.protobuf.Internal
类名称:Internal
方法名:hashEnumList
[英]Helper method for implementing MessageLite#hashCode() for enum lists.
[中]用于为枚举列表实现MessageLite#hashCode()的助手方法。
代码示例来源:origin: com.google.protobuf/protobuf-java
/** Get a hash code for given fields and values, using the given seed. */
@SuppressWarnings("unchecked")
protected static int hashFields(int hash, Map<FieldDescriptor, Object> map) {
for (Map.Entry<FieldDescriptor, Object> entry : map.entrySet()) {
FieldDescriptor field = entry.getKey();
Object value = entry.getValue();
hash = (37 * hash) + field.getNumber();
if (field.isMapField()) {
hash = (53 * hash) + hashMapField(value);
} else if (field.getType() != FieldDescriptor.Type.ENUM){
hash = (53 * hash) + value.hashCode();
} else if (field.isRepeated()) {
List<? extends EnumLite> list = (List<? extends EnumLite>) value;
hash = (53 * hash) + Internal.hashEnumList(list);
} else {
hash = (53 * hash) + Internal.hashEnum((EnumLite) value);
}
}
return hash;
}
代码示例来源:origin: WeAreFairphone/FP2-Launcher
/** Get a hash code for given fields and values, using the given seed. */
@SuppressWarnings("unchecked")
protected static int hashFields(int hash, Map<FieldDescriptor, Object> map) {
for (Map.Entry<FieldDescriptor, Object> entry : map.entrySet()) {
FieldDescriptor field = entry.getKey();
Object value = entry.getValue();
hash = (MAGIC_NUMBER_37 * hash) + field.getNumber();
if (field.getType() != FieldDescriptor.Type.ENUM){
hash = (MAGIC_NUMBER_53 * hash) + value.hashCode();
} else if (field.isRepeated()) {
List<? extends EnumLite> list = (List<? extends EnumLite>) value;
hash = (MAGIC_NUMBER_53 * hash) + Internal.hashEnumList(list);
} else {
hash = (MAGIC_NUMBER_53 * hash) + Internal.hashEnum((EnumLite) value);
}
}
return hash;
}
代码示例来源:origin: yeriomin/play-store-api
/** Get a hash code for given fields and values, using the given seed. */
@SuppressWarnings("unchecked")
protected static int hashFields(int hash, Map<FieldDescriptor, Object> map) {
for (Map.Entry<FieldDescriptor, Object> entry : map.entrySet()) {
FieldDescriptor field = entry.getKey();
Object value = entry.getValue();
hash = (37 * hash) + field.getNumber();
if (field.isMapField()) {
hash = (53 * hash) + hashMapField(value);
} else if (field.getType() != FieldDescriptor.Type.ENUM){
hash = (53 * hash) + value.hashCode();
} else if (field.isRepeated()) {
List<? extends EnumLite> list = (List<? extends EnumLite>) value;
hash = (53 * hash) + Internal.hashEnumList(list);
} else {
hash = (53 * hash) + Internal.hashEnum((EnumLite) value);
}
}
return hash;
}
代码示例来源:origin: com.github.protobufel/protobufel-protobuf-test-protos
hash = (53 * hash) + com.google.protobuf.Internal.hashEnumList(
getEnumField2List());
hash = (53 * hash) + com.google.protobuf.Internal.hashEnumList(
getEnumField22List());
内容来源于网络,如有侵权,请联系作者删除!