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


Java ImmutableMap.forEach方法代码示例

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


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

示例1: writeDependencies

import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
private static void writeDependencies(
    final PrintWriter out,
    final ImmutableMap<MavenCoords, Boolean> transitiveDependencies,
    final ImmutableMap<MavenCoords, MavenDependency> dependenciesByCoords) {
  // Add all non-public dependencies as JAR references
  transitiveDependencies.forEach(
      (mavenCoords, isPublic) -> {
        if (!isPublic) {
          printWorkspaceJarReference(out, mavenCoords);

          // ... but we need to also add the transitive dependencies of that dependency
          writeDependencies(
              out, dependenciesByCoords.get(mavenCoords).dependencies(), dependenciesByCoords);
        }
      });

  // Add all public dependencies as references to their public //3rdparty/jvm paths
  transitiveDependencies.forEach(
      (mavenCoords, isPublic) -> {
        if (isPublic) {
          out.printf(
              "        \"//3rdparty/jvm/%s:%s\",\n",
              mavenCoords.groupRelativePackageName(), mavenCoords.artifactLabel());
        }
      });
}
 
开发者ID:spotify,项目名称:bazel-tools,代码行数:27,代码来源:Main.java

示例2: pathPropertiesOfAsMultimap

import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
public static ImmutableMultimap<String, Object> pathPropertiesOfAsMultimap(Blob blob, Function<String, Collection<String>> pathPropertyMapping, Path path, PropertyCollectionResolver propertyResolver) {
	ImmutableList<String> pathProperties = path.propertyNamesWithoutPage();
	
	ImmutableMap<String, ImmutableSet<?>> blopPathPropertyMap = pathProperties.stream()
		.map(p -> Pair.<String, ImmutableSet<?>>of(p, propertyOf(blob, pathPropertyMapping, propertyResolver, p)))
		.filter(pair -> !pair.b().isEmpty())
		.collect(ImmutableMap.toImmutableMap(Pair::a, Pair::b));
	
	if (blopPathPropertyMap.keySet().size()<pathProperties.size()) {
		return ImmutableMultimap.of();
	}
	
	Builder<String, Object> multiMapBuilder = ImmutableMultimap.builder();
	
	blopPathPropertyMap.forEach((key, values) -> {
		multiMapBuilder.putAll(key, values);
	});
	
	return multiMapBuilder.build();
}
 
开发者ID:flapdoodle-oss,项目名称:de.flapdoodle.solid,代码行数:21,代码来源:Blobs.java

示例3: render

import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
private static void render(StringBuilder sb, GroupedPropertyMap map, ImmutableList<String> current) {
	String prefix=Strings.repeat(INDENT, current.size());
	String[] array = current.toArray(new String[current.size()]);
	
	ImmutableMap<String, Object> properties = map.propertiesOf(array);
	properties.forEach((key,val) -> {
		sb.append(prefix).append(INDENT).append(key).append("=").append(val).append("\n");
	});
	
	ImmutableSet<String> groups = map.groupsOf(array);
	groups.forEach(g -> {
		sb.append(prefix).append(INDENT).append(g).append("=").append("{\n");
		render(sb,map,ImmutableList.<String>builder().addAll(current).add(g).build());
		sb.append(prefix).append(INDENT).append("}\n");
	});
}
 
开发者ID:flapdoodle-oss,项目名称:de.flapdoodle.solid,代码行数:17,代码来源:GroupedPropertyMapPrinter.java

示例4: filter

import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
private static ImmutableMap<ImmutableMap<String, Object>, Collection<Blob>> filter(ImmutableMap<ImmutableMap<String, Object>, Collection<Blob>> src, String key,
		Object value) {
	ImmutableMap.Builder<ImmutableMap<String, Object>, Collection<Blob>> builder=ImmutableMap.builder();
	src.forEach((k,blobs) -> {
		if (value.equals(k.get(key))) {
			builder.put(k, blobs);
		}
	});
	return builder.build();
}
 
开发者ID:flapdoodle-oss,项目名称:de.flapdoodle.solid,代码行数:11,代码来源:DefaultLinkFactory.java


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