private JavaContainerBuilder addDirectory(
      List<PathPredicatePair> addedPaths, Path directory, Predicate<Path> filter)
      throws NoSuchFileException, NotDirectoryException {
    if (!Files.exists(directory)) {
      throw new NoSuchFileException(directory.toString());
    }
    if (!Files.isDirectory(directory)) {
      throw new NotDirectoryException(directory.toString());
    }
    addedPaths.add(new PathPredicatePair(directory, filter));
    return this;
  }
Returns a new {@link JibContainerBuilder} using the parameters specified on the {@link
JavaContainerBuilder}.

@return a new {@link JibContainerBuilder} using the parameters specified on the {@link
    JavaContainerBuilder}
@throws IOException if building the {@link JibContainerBuilder} fails.
jib-core/src/main/java/com/google/cloud/tools/jib/api/JavaContainerBuilder.java