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


Java ListMultimapBuilder类代码示例

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


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

示例1: calculateSkylarkStatistics

import com.google.common.collect.MultimapBuilder.ListMultimapBuilder; //导入依赖的package包/类
/**
 * Collects all Skylark function tasks. Must be called before calling
 * {@link #getSkylarkUserFunctionTasks} and {@link #getSkylarkBuiltinFunctionTasks}.
 */
private void calculateSkylarkStatistics() {
  userFunctions = ListMultimapBuilder.treeKeys().arrayListValues().build();
  compiledUserFunctions = ListMultimapBuilder.treeKeys().arrayListValues().build();
  builtinFunctions = ListMultimapBuilder.treeKeys().arrayListValues().build();

  for (Task task : allTasksById) {
    if (task.type == ProfilerTask.SKYLARK_BUILTIN_FN) {
      builtinFunctions.put(task.getDescription(), task);
    } else if (task.type == ProfilerTask.SKYLARK_USER_FN) {
      userFunctions.put(task.getDescription(), task);
    } else if (task.type == ProfilerTask.SKYLARK_USER_COMPILED_FN) {
      compiledUserFunctions.put(task.getDescription(), task);
    }
  }
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:20,代码来源:ProfileInfo.java

示例2: loadAll

import com.google.common.collect.MultimapBuilder.ListMultimapBuilder; //导入依赖的package包/类
@Override
public void loadAll(GridCacheTx tx, Collection<? extends String> keys,
		GridBiInClosure<String, ListMultimap<String, String>> c) throws GridException {
	ImmutableMap<? extends String, ListMultimap<String, String>> resultMap = Maps.toMap(keys,
			(it) -> ListMultimapBuilder.<String, String>hashKeys().arrayListValues().build());
	
	String quoteds = Joiner.on('|').join( keys.stream().map((it) -> Pattern.quote(it)).collect(Collectors.toList()) );
	Pattern pattern = Pattern.compile("^(" + quoteds + ")$", Pattern.CASE_INSENSITIVE);
	
	ImmutableList<ImmutableMap<String, Pattern>> crits = ImmutableList.of(
			ImmutableMap.of("p", pattern),
			ImmutableMap.of("l", pattern),
			ImmutableMap.of("m", pattern),
			ImmutableMap.of("g", pattern),
			ImmutableMap.of("f", pattern) );
	BasicDBObject crit = new BasicDBObject("$or", crits);
	log.debug("Finding {} : {}", keys, crit);
	try (DBCursor cursor = labelColl.find(crit).setReadPreference(ReadPreference.secondaryPreferred())) {
		for (DBObject dbo : cursor) {
			String entityId = (String) dbo.get("_id");
			final YagoLabel label = toYagoLabel(dbo);
			for (String key : keys) {
				final ListMultimap<String, String> labelResult = resultMap.get(key);
				if (label.getPreferredMeaningLabels() != null && label.getPreferredMeaningLabels().stream().anyMatch( (it) -> it.equalsIgnoreCase(key) )) {
					log.debug("{} isPreferredMeaningOf {}", entityId, key);
					// if has isPreferredMeaningOf, then this entity is prioritized for this label
					labelResult.get("_").remove(entityId);
					labelResult.get("_").add(0, entityId);
				} else if (!labelResult.get("_").contains(entityId)) {
					if (StringUtils.equalsIgnoreCase(key, label.getPrefLabel()) ||
							label.getLabels().stream().anyMatch( (it) -> it.equalsIgnoreCase(key) ) ||
							StringUtils.equalsIgnoreCase(key, label.getGivenName()) ||
							StringUtils.equalsIgnoreCase(key, label.getFamilyName()) ) {
						labelResult.get("_").add(entityId);
					}
				}
			}
		}
	}
	
	resultMap.forEach(c::apply);
}
 
开发者ID:lumenrobot,项目名称:lumen-kb,代码行数:43,代码来源:YagoEntityByLabelCacheStore.java

示例3: PlayerListMultimap

import com.google.common.collect.MultimapBuilder.ListMultimapBuilder; //导入依赖的package包/类
/**
 * Constructor.
 *
 * @param plugin   The owning plugin.
 */
public PlayerListMultimap(Plugin plugin) {
    super(plugin);

    _map = ListMultimapBuilder.hashKeys().arrayListValues().build();
}
 
开发者ID:JCThePants,项目名称:NucleusFramework,代码行数:11,代码来源:PlayerListMultimap.java


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