當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。