本文整理汇总了Java中com.google.common.collect.Maps.newIdentityHashMap方法的典型用法代码示例。如果您正苦于以下问题:Java Maps.newIdentityHashMap方法的具体用法?Java Maps.newIdentityHashMap怎么用?Java Maps.newIdentityHashMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.Maps
的用法示例。
在下文中一共展示了Maps.newIdentityHashMap方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepare
import com.google.common.collect.Maps; //导入方法依赖的package包/类
@Override
public CompletableFuture<Boolean> prepare(MapTransaction<K, V> transaction) {
Map<AsyncConsistentMap<K, V>, List<MapUpdate<K, V>>> updatesGroupedByMap = Maps.newIdentityHashMap();
transaction.updates().forEach(update -> {
AsyncConsistentMap<K, V> map = getMap(update.key());
updatesGroupedByMap.computeIfAbsent(map, k -> Lists.newLinkedList()).add(update);
});
Map<AsyncConsistentMap<K, V>, MapTransaction<K, V>> transactionsByMap =
Maps.transformValues(updatesGroupedByMap,
list -> new MapTransaction<>(transaction.transactionId(), list));
return Tools.allOf(transactionsByMap.entrySet()
.stream()
.map(e -> e.getKey().prepare(e.getValue()))
.collect(Collectors.toList()))
.thenApply(list -> list.stream().reduce(Boolean::logicalAnd).orElse(true));
}
示例2: prepareAndCommit
import com.google.common.collect.Maps; //导入方法依赖的package包/类
@Override
public CompletableFuture<Boolean> prepareAndCommit(MapTransaction<K, V> transaction) {
Map<AsyncConsistentMap<K, V>, List<MapUpdate<K, V>>> updatesGroupedByMap = Maps.newIdentityHashMap();
transaction.updates().forEach(update -> {
AsyncConsistentMap<K, V> map = getMap(update.key());
updatesGroupedByMap.computeIfAbsent(map, k -> Lists.newLinkedList()).add(update);
});
Map<AsyncConsistentMap<K, V>, MapTransaction<K, V>> transactionsByMap =
Maps.transformValues(updatesGroupedByMap,
list -> new MapTransaction<>(transaction.transactionId(), list));
return Tools.allOf(transactionsByMap.entrySet()
.stream()
.map(e -> e.getKey().prepareAndCommit(e.getValue()))
.collect(Collectors.toList()))
.thenApply(list -> list.stream().reduce(Boolean::logicalAnd).orElse(true));
}
示例3: ensureDebugInfosExist
import com.google.common.collect.Maps; //导入方法依赖的package包/类
private void ensureDebugInfosExist(ClassSubject overloaded) {
final Map<DexString, Boolean> hasDebugInfo = Maps.newIdentityHashMap();
overloaded.forAllMethods(method -> {
if (!method.isAbstract()) {
DexCode code = method.getMethod().getCode().asDexCode();
DexString name = method.getMethod().method.name;
Boolean previous = hasDebugInfo.get(name);
boolean current = code.getDebugInfo() != null;
// If we have seen one before, it should be the same as now.
assertTrue(previous == null || (previous == current));
hasDebugInfo.put(name, current);
}
}
);
}
示例4: putAllStateModelLocations
import com.google.common.collect.Maps; //导入方法依赖的package包/类
public Map<IBlockState, ModelResourceLocation> putAllStateModelLocations()
{
Map<IBlockState, ModelResourceLocation> map = Maps.<IBlockState, ModelResourceLocation>newIdentityHashMap();
for (Block block : Block.blockRegistry)
{
if (!this.setBuiltInBlocks.contains(block))
{
map.putAll(((IStateMapper)Objects.firstNonNull(this.blockStateMap.get(block), new DefaultStateMapper())).putStateModelLocations(block));
}
}
return map;
}
示例5: putAllStateModelLocations
import com.google.common.collect.Maps; //导入方法依赖的package包/类
public Map<IBlockState, ModelResourceLocation> putAllStateModelLocations()
{
Map<IBlockState, ModelResourceLocation> map = Maps.<IBlockState, ModelResourceLocation>newIdentityHashMap();
for (Block block : Block.REGISTRY)
{
map.putAll(this.getVariants(block));
}
return map;
}
示例6: DeviceProviderRegistryClientProxy
import com.google.common.collect.Maps; //导入方法依赖的package包/类
DeviceProviderRegistryClientProxy(ManagedChannel channel) {
this.channel = channel;
pServices = Maps.newIdentityHashMap();
}