本文整理匯總了Java中com.google.common.collect.HashBiMap.put方法的典型用法代碼示例。如果您正苦於以下問題:Java HashBiMap.put方法的具體用法?Java HashBiMap.put怎麽用?Java HashBiMap.put使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.common.collect.HashBiMap
的用法示例。
在下文中一共展示了HashBiMap.put方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: build
import com.google.common.collect.HashBiMap; //導入方法依賴的package包/類
GqlInputConverter build() {
HashBiMap<String, Descriptor> mapping = HashBiMap.create();
HashBiMap<String, EnumDescriptor> enumMapping = HashBiMap.create(getEnumMap(enumDescriptors));
LinkedList<Descriptor> loop = new LinkedList<>(descriptors);
Set<FileDescriptor> fileDescriptorSet = ProtoRegistry.extractDependencies(fileDescriptors);
for (FileDescriptor fileDescriptor : fileDescriptorSet) {
loop.addAll(fileDescriptor.getMessageTypes());
enumMapping.putAll(getEnumMap(fileDescriptor.getEnumTypes()));
}
while (!loop.isEmpty()) {
Descriptor descriptor = loop.pop();
if (!mapping.containsKey(descriptor.getFullName())) {
mapping.put(getReferenceName(descriptor), descriptor);
loop.addAll(descriptor.getNestedTypes());
enumMapping.putAll(getEnumMap(descriptor.getEnumTypes()));
}
}
return new GqlInputConverter(
ImmutableBiMap.copyOf(mapping), ImmutableBiMap.copyOf(enumMapping));
}
示例2: getEnumMap
import com.google.common.collect.HashBiMap; //導入方法依賴的package包/類
private static BiMap<String, EnumDescriptor> getEnumMap(Iterable<EnumDescriptor> descriptors) {
HashBiMap<String, EnumDescriptor> mapping = HashBiMap.create();
for (EnumDescriptor enumDescriptor : descriptors) {
mapping.put(ProtoToGql.getReferenceName(enumDescriptor), enumDescriptor);
}
return mapping;
}
示例3: getMap
import com.google.common.collect.HashBiMap; //導入方法依賴的package包/類
private static BiMap<String, GraphQLType> getMap(
List<FileDescriptor> fileDescriptors,
List<Descriptor> descriptors,
List<EnumDescriptor> enumDescriptors,
GraphQLInterfaceType nodeInterface) {
HashBiMap<String, GraphQLType> mapping = HashBiMap.create(getEnumMap(enumDescriptors));
LinkedList<Descriptor> loop = new LinkedList<>(descriptors);
Set<FileDescriptor> fileDescriptorSet = extractDependencies(fileDescriptors);
for (FileDescriptor fileDescriptor : fileDescriptorSet) {
loop.addAll(fileDescriptor.getMessageTypes());
mapping.putAll(getEnumMap(fileDescriptor.getEnumTypes()));
}
while (!loop.isEmpty()) {
Descriptor descriptor = loop.pop();
if (!mapping.containsKey(descriptor.getFullName())) {
mapping.put(
ProtoToGql.getReferenceName(descriptor),
ProtoToGql.convert(descriptor, nodeInterface));
GqlInputConverter inputConverter =
GqlInputConverter.newBuilder().add(descriptor.getFile()).build();
mapping.put(
GqlInputConverter.getReferenceName(descriptor),
inputConverter.getInputType(descriptor));
loop.addAll(descriptor.getNestedTypes());
mapping.putAll(getEnumMap(descriptor.getEnumTypes()));
}
}
return ImmutableBiMap.copyOf(mapping);
}
示例4: getEnumMap
import com.google.common.collect.HashBiMap; //導入方法依賴的package包/類
private static BiMap<String, GraphQLType> getEnumMap(Iterable<EnumDescriptor> descriptors) {
HashBiMap<String, GraphQLType> mapping = HashBiMap.create();
for (EnumDescriptor enumDescriptor : descriptors) {
mapping.put(
ProtoToGql.getReferenceName(enumDescriptor), ProtoToGql.convert(enumDescriptor));
}
return mapping;
}
示例5: generateHashBiMap
import com.google.common.collect.HashBiMap; //導入方法依賴的package包/類
@Generates private static <K, V> HashBiMap<K, V> generateHashBiMap(K key, V value) {
HashBiMap<K, V> bimap = HashBiMap.create();
bimap.put(key, value);
return bimap;
}