当前位置: 首页>>代码示例>>Java>>正文


Java Maps.newIdentityHashMap方法代码示例

本文整理汇总了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));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:19,代码来源:PartitionedAsyncConsistentMap.java

示例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));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:PartitionedAsyncConsistentMap.java

示例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);
        }
      }
  );
}
 
开发者ID:inferjay,项目名称:r8,代码行数:16,代码来源:R8DebugStrippingTest.java

示例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;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:15,代码来源:BlockStateMapper.java

示例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;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:12,代码来源:BlockStateMapper.java

示例6: DeviceProviderRegistryClientProxy

import com.google.common.collect.Maps; //导入方法依赖的package包/类
DeviceProviderRegistryClientProxy(ManagedChannel channel) {
    this.channel = channel;
    pServices = Maps.newIdentityHashMap();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:5,代码来源:DeviceProviderRegistryClientProxy.java


注:本文中的com.google.common.collect.Maps.newIdentityHashMap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。