本文整理匯總了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();
}