Java Code Examples for com.google.common.collect.ImmutableSortedSet#forEach()

The following examples show how to use com.google.common.collect.ImmutableSortedSet#forEach() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DaemonicParserState.java    From buck with Apache License 2.0 6 votes vote down vote up
/** 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()));
  }
}
 
Example 2
Source File: AbstractSourcePathResolver.java    From buck with Apache License 2.0 5 votes vote down vote up
/**
 * @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;
}
 
Example 3
Source File: AbstractSourcePathResolver.java    From buck with Apache License 2.0 4 votes vote down vote up
private ImmutableSortedSet<Path> getPathsPrivateImpl(ImmutableSortedSet<SourcePath> sourcePaths) {
  ImmutableSortedSet.Builder<Path> pathsBuilder = ImmutableSortedSet.naturalOrder();
  sourcePaths.forEach(sourcePath -> pathsBuilder.addAll(getPathPrivateImpl(sourcePath)));
  return pathsBuilder.build();
}