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


Java Multimap.asMap方法代码示例

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


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

示例1: collectExternalProjectDependents

import com.google.common.collect.Multimap; //导入方法依赖的package包/类
/**
 * Sugar for collecting {@link IWorkspace Eclipse workspace} projects that have any direct dependency to any
 * external projects. Same as {@link #collectExternalProjectDependents()} but does not consider all the available
 * projects but only those that are given as the argument.
 *
 * @param externalProjects
 *            the external projects that has to be considered as a possible dependency of an Eclipse workspace based
 *            project.
 * @return a map where each entry maps an external project to the workspace projects that depend on it.
 */
public Map<IProject, Collection<IProject>> collectExternalProjectDependents(
		final Iterable<? extends IProject> externalProjects) {
	final Multimap<IProject, IProject> mapping = Multimaps2.newLinkedHashListMultimap();

	if (Platform.isRunning()) {

		final Map<String, IProject> externalsMapping = new HashMap<>();
		externalProjects.forEach(p -> externalsMapping.put(p.getName(), p));

		asList(getWorkspace().getRoot().getProjects()).forEach(p -> {
			getDirectExternalDependencyIds(p).forEach(eID -> {
				IProject externalDependency = externalsMapping.get(eID);
				if (externalDependency != null) {
					mapping.put(externalDependency, p);
				}
			});
		});

	}

	return mapping.asMap();
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:33,代码来源:ExternalProjectsCollector.java

示例2: groupBySubject

import com.google.common.collect.Multimap; //导入方法依赖的package包/类
private Map<Node, Collection<Triple>> groupBySubject(Set<Triple> triples) {
	Multimap<Node, Triple> subject2Triples = HashMultimap.create();
	for (Triple triple : triples) {
		subject2Triples.put(triple.getSubject(), triple);
	}
	return subject2Triples.asMap();
}
 
开发者ID:dice-group,项目名称:RDF2PT,代码行数:8,代码来源:DocumentGeneratorPortuguese.java

示例3: serialize

import com.google.common.collect.Multimap; //导入方法依赖的package包/类
@Override
public JsonElement serialize(Multimap<String, ?> src, Type type, JsonSerializationContext context)
{
    final Map<?, ?> map = src.asMap();
    return context.serialize(map);
}
 
开发者ID:PaleoCrafter,项目名称:CurseSync,代码行数:7,代码来源:MultimapAdapter.java


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