本文整理汇总了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());
}
示例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();
}
示例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();
}