下面列出了com.google.common.collect.ImmutableSortedSet#forEach ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/** Add all the includes from the manifest and Buck defaults. */
private static void addAllIncludes(
ImmutableSet.Builder<AbsPath> dependents,
ImmutableSortedSet<String> manifestIncludes,
Cell cell) {
manifestIncludes.forEach(
includedPath -> dependents.add(AbsPath.of(cell.getFilesystem().resolve(includedPath))));
// We also know that the all manifests depend on the default includes for the cell.
// Note: This is a bad assumption. While both the project build file and package parsers set
// the default includes of the ParserConfig, it is not required and this assumption may not
// always hold.
BuckConfig buckConfig = cell.getBuckConfig();
Iterable<String> defaultIncludes = buckConfig.getView(ParserConfig.class).getDefaultIncludes();
for (String include : defaultIncludes) {
dependents.add(resolveIncludePath(cell, include, cell.getCellPathResolver()));
}
}
/**
* @return The {@link Path} instances the {@code sourcePath} refers to, relative to its owning
* {@link ProjectFilesystem}.
*/
@Override
public ImmutableSortedSet<Path> getRelativePath(SourcePath sourcePath) {
ImmutableSortedSet<Path> toReturns = getPathPrivateImpl(sourcePath);
toReturns.forEach(
toReturn ->
Preconditions.checkState(
!toReturn.isAbsolute(),
"Expected path to be relative, not absolute: %s (from %s)",
toReturn,
sourcePath));
return toReturns;
}
private ImmutableSortedSet<Path> getPathsPrivateImpl(ImmutableSortedSet<SourcePath> sourcePaths) {
ImmutableSortedSet.Builder<Path> pathsBuilder = ImmutableSortedSet.naturalOrder();
sourcePaths.forEach(sourcePath -> pathsBuilder.addAll(getPathPrivateImpl(sourcePath)));
return pathsBuilder.build();
}