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


Java Multimaps.newSetMultimap方法代码示例

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


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

示例1: constructExposedToExposers

import com.google.common.collect.Multimaps; //导入方法依赖的package包/类
/** See {@link #getExposedToExposers}. */
private void constructExposedToExposers() {
  visited = Sets.newHashSet();
  exposedToExposers =
      Multimaps.newSetMultimap(
          Maps.<Class<?>, Collection<Class<?>>>newHashMap(),
          new Supplier<Set<Class<?>>>() {
            @Override
            public Set<Class<?>> get() {
              return Sets.newHashSet();
            }
          });

  for (Class<?> clazz : rootClasses) {
    addExposedTypes(clazz, null);
  }
}
 
开发者ID:apache,项目名称:beam,代码行数:18,代码来源:ApiSurface.java

示例2: getExportingConfigurations

import com.google.common.collect.Multimaps; //导入方法依赖的package包/类
/**
 * Get the configurations that export an artifact
 *
 * @param projects Projects to search
 * @return Exporting configurations
 */
protected Multimap<@NonNull String, @NonNull ExportingConfiguration> getExportingConfigurations(
        Collection<@NonNull Project> projects) {
    Multimap<@NonNull String, @NonNull ExportingConfiguration> exports = Multimaps.newSetMultimap(new HashMap<>(),
            () -> new TreeSet<>(CONFIGURATION_INFO_COMPARATOR));

    for (Project project : projects) {
        Set<String> configurationNames = ImmutableSet.of("default");
        WorkspaceConfig workspaceConfig = project.getExtensions().findByType(WorkspaceConfig.class);

        if (workspaceConfig != null) {
            configurationNames = workspaceConfig.getExportedConfigurations();
        }

        for (String configurationName : configurationNames) {
            Configuration configuration = project.getConfigurations().findByName(configurationName);

            if (configuration != null) {
                getExportingConfigurations(project, configuration, exports);
            }
        }
    }

    return exports;
}
 
开发者ID:jochenseeber,项目名称:gradle-workspace-plugin,代码行数:31,代码来源:WorkspacePlugin.java

示例3: SimpleSchemaContext

import com.google.common.collect.Multimaps; //导入方法依赖的package包/类
protected SimpleSchemaContext(final Set<Module> modules) {
    /*
     * Instead of doing this on each invocation of getModules(), pre-compute it once and keep it around -- better
     * than the set we got in.
     *
     * Note we are performing two sort operations: the dependency sort takes care of detecting multiple imports,
     * performing sorting as a side-effect, but we really want the modules sorted to comply with getModules().
     */
    final List<Module> sortedModules = new ArrayList<>(ModuleDependencySort.sort(modules));
    sortedModules.sort(NAME_REVISION_COMPARATOR);
    this.modules = ImmutableSet.copyOf(sortedModules);

    /*
     * The most common lookup is from Namespace->Module.
     *
     * RESTCONF performs lookups based on module name only, where it wants
     * to receive the latest revision
     *
     * Invest some quality time in building up lookup tables for both.
     */
    final SetMultimap<URI, Module> nsMap = Multimaps.newSetMultimap(new TreeMap<>(),
        AbstractSchemaContext::createModuleSet);
    final SetMultimap<String, Module> nameMap = Multimaps.newSetMultimap(new TreeMap<>(),
        AbstractSchemaContext::createModuleSet);
    final Builder<QNameModule, Module> moduleMapBuilder = ImmutableMap.builder();
    for (Module m : modules) {
        nameMap.put(m.getName(), m);
        nsMap.put(m.getNamespace(), m);
        moduleMapBuilder.put(m.getQNameModule(), m);
    }

    namespaceToModules = ImmutableSetMultimap.copyOf(nsMap);
    nameToModules = ImmutableSetMultimap.copyOf(nameMap);
    moduleMap = moduleMapBuilder.build();
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:36,代码来源:SimpleSchemaContext.java

示例4: newConcurrentMultimap

import com.google.common.collect.Multimaps; //导入方法依赖的package包/类
public static <K, V> SetMultimap<K, V> newConcurrentMultimap() {
    return Multimaps.newSetMultimap(new ConcurrentHashMap<K, Collection<V>>(), new Supplier<Set<V>>() {

        @Override
        public Set<V> get() {
            return newConcurrentHashSet();
        }
    });
}
 
开发者ID:TechzoneMC,项目名称:TechUtils,代码行数:10,代码来源:Collections3.java

示例5: TypeMap

import com.google.common.collect.Multimaps; //导入方法依赖的package包/类
public TypeMap(Map<TypeToken<? extends K>, ? extends Collection<V>> map, Supplier<Set<V>> supplier) {
    this(Multimaps.newSetMultimap((Map) map, supplier::get));
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:4,代码来源:TypeMap.java

示例6: Context

import com.google.common.collect.Multimaps; //导入方法依赖的package包/类
public Context(int expectedNumRelations, Predicate<Symbol> skipIf){
    fields = Multimaps.newSetMultimap(
            new IdentityHashMap<AnalyzedRelation, Collection<Symbol>>(expectedNumRelations),
            FIELD_SET_SUPPLIER);
    this.skipIf = skipIf;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:7,代码来源:FieldCollectingVisitor.java

示例7: FilteringSchemaContextProxy

import com.google.common.collect.Multimaps; //导入方法依赖的package包/类
/**
 * Filters SchemaContext for yang modules.
 *
 * @param delegate original SchemaContext
 * @param rootModules modules (yang schemas) to be available and all their dependencies (modules importing
 *                    rootModule and whole chain of their imports)
 * @param additionalModuleIds (additional) modules (yang schemas) to be available and whole chain of their imports
 */
public FilteringSchemaContextProxy(final SchemaContext delegate, final Collection<ModuleId> rootModules,
        final Set<ModuleId> additionalModuleIds) {
    Preconditions.checkNotNull(rootModules, "Base modules cannot be null.");
    Preconditions.checkNotNull(additionalModuleIds, "Additional modules cannot be null.");

    final Builder<Module> filteredModulesBuilder = new Builder<>();

    // preparing map to get all modules with one name but difference in revision
    final TreeMultimap<String, Module> nameToModulesAll = TreeMultimap.create(String::compareTo,
        REVISION_COMPARATOR);

    nameToModulesAll.putAll(getStringModuleMap(delegate));

    // in case there is a particular dependency to view filteredModules/YANG models dependency is checked
    // for module name and imports
    processForRootModules(delegate, rootModules, filteredModulesBuilder);

    // adding additional modules
    processForAdditionalModules(delegate, additionalModuleIds, filteredModulesBuilder);

    filteredModulesBuilder.addAll(getImportedModules(
            Maps.uniqueIndex(delegate.getModules(), ModuleId.MODULE_TO_MODULE_ID::apply),
            filteredModulesBuilder.build(), nameToModulesAll));

    /**
     * Instead of doing this on each invocation of getModules(), pre-compute it once and keep it around.
     */
    final List<Module> sortedModules = new ArrayList<>(filteredModulesBuilder.build());
    sortedModules.sort(NAME_REVISION_COMPARATOR);
    this.filteredModules = ImmutableSet.copyOf(sortedModules);

    final SetMultimap<URI, Module> nsMap = Multimaps.newSetMultimap(new TreeMap<>(),
        AbstractSchemaContext::createModuleSet);
    final SetMultimap<String, Module> nameMap = Multimaps.newSetMultimap(new TreeMap<>(),
        AbstractSchemaContext::createModuleSet);
    final ImmutableMap.Builder<QNameModule, Module> moduleMapBuilder = ImmutableMap.builder();
    for (final Module module : filteredModules) {
        nameMap.put(module.getName(), module);
        nsMap.put(module.getNamespace(), module);
        moduleMapBuilder.put(module.getQNameModule(), module);
    }

    namespaceToModules = ImmutableSetMultimap.copyOf(nsMap);
    nameToModules = ImmutableSetMultimap.copyOf(nameMap);
    moduleMap = moduleMapBuilder.build();
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:55,代码来源:FilteringSchemaContextProxy.java


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