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


Java ImmutableSetMultimap.keySet方法代码示例

本文整理汇总了Java中com.google.common.collect.ImmutableSetMultimap.keySet方法的典型用法代码示例。如果您正苦于以下问题:Java ImmutableSetMultimap.keySet方法的具体用法?Java ImmutableSetMultimap.keySet怎么用?Java ImmutableSetMultimap.keySet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.common.collect.ImmutableSetMultimap的用法示例。


在下文中一共展示了ImmutableSetMultimap.keySet方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: matchCompilationUnit

import com.google.common.collect.ImmutableSetMultimap; //导入方法依赖的package包/类
@Override
public Description matchCompilationUnit(
    CompilationUnitTree compilationUnitTree, VisitorState state) {
  final ImmutableSetMultimap<ImportTree, Symbol> importedSymbols =
      getImportedSymbols(compilationUnitTree, state);

  if (importedSymbols.isEmpty()) {
    return NO_MATCH;
  }

  final Set<ImportTree> unusedImports = new HashSet<>(importedSymbols.keySet());
  new TreeSymbolScanner(JavacTrees.instance(state.context), state.getTypes())
      .scan(
          compilationUnitTree,
          new SymbolSink() {
            @Override
            public boolean keepScanning() {
              return !unusedImports.isEmpty();
            }

            @Override
            public void accept(Symbol symbol) {
              unusedImports.removeAll(importedSymbols.inverse().get(symbol));
            }
          });

  if (unusedImports.isEmpty()) {
    return NO_MATCH;
  }
  SuggestedFix.Builder fixBuilder = SuggestedFix.builder();
  for (ImportTree unusedImport : unusedImports) {
    fixBuilder.delete(unusedImport);
  }
  return describeMatch(unusedImports.iterator().next(), fixBuilder.build());
}
 
开发者ID:google,项目名称:error-prone,代码行数:36,代码来源:RemoveUnusedImports.java

示例2: getSeeds

import com.google.common.collect.ImmutableSetMultimap; //导入方法依赖的package包/类
@Override
public ImmutableSet<String> getSeeds(CassandraRing ring) {
  ImmutableSet.Builder<String> seedBuilder = ImmutableSet.builder();
  ImmutableSetMultimap<String, CassandraInstance> dataCenterToInstanceMap =
      buildDataCenterToInstanceMap(ring.getInstances());

  for (String dc : dataCenterToInstanceMap.keySet()) {
    seedBuilder.addAll(getSeeds(dc, dataCenterToInstanceMap.get(dc)));
  }

  return seedBuilder.build();
}
 
开发者ID:signal,项目名称:agathon,代码行数:13,代码来源:PerDataCenterSeedService.java

示例3: getNeededDependencies

import com.google.common.collect.ImmutableSetMultimap; //导入方法依赖的package包/类
/**
 * Using missing symbol events from the build and the JavaSymbolFinder class, build a list of
 * missing dependencies for each broken target.
 */
public ImmutableSetMultimap<BuildTarget, BuildTarget> getNeededDependencies(
    Collection<MissingSymbolEvent> missingSymbolEvents) throws InterruptedException {
  ImmutableSetMultimap.Builder<BuildTarget, String> targetsMissingSymbolsBuilder =
      ImmutableSetMultimap.builder();
  for (MissingSymbolEvent event : missingSymbolEvents) {
    if (event.getType() != MissingSymbolEvent.SymbolType.Java) {
      throw new UnsupportedOperationException("Only implemented for Java.");
    }
    targetsMissingSymbolsBuilder.put(event.getTarget(), event.getSymbol());
  }
  ImmutableSetMultimap<BuildTarget, String> targetsMissingSymbols =
      targetsMissingSymbolsBuilder.build();
  ImmutableSetMultimap<String, BuildTarget> symbolProviders =
      javaSymbolFinder.findTargetsForSymbols(ImmutableSet.copyOf(targetsMissingSymbols.values()));

  ImmutableSetMultimap.Builder<BuildTarget, BuildTarget> neededDeps =
      ImmutableSetMultimap.builder();

  for (BuildTarget target: targetsMissingSymbols.keySet()) {
    for (String symbol : targetsMissingSymbols.get(target)) {
      // TODO(jacko): Properly handle symbols that are defined in more than one place.
      // TODO(jacko): Properly handle target visibility.
      neededDeps.putAll(target, ImmutableSortedSet.copyOf(symbolProviders.get(symbol)));
    }
  }

  return neededDeps.build();
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:33,代码来源:MissingSymbolsHandler.java


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