本文整理汇总了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());
}
});
}
示例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();
}
示例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");
});
}
示例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();
}