當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。