private static Predicate<Path> isInListedDirectoryOrIsSameFile(
      List<String> layerContents, Path localExplodedJarRoot) {
    Predicate<Path> predicate = Predicates.alwaysFalse();
    for (String pathName : layerContents) {
      if (pathName.endsWith("/")) {
        predicate = predicate.or(path -> path.startsWith(localExplodedJarRoot.resolve(pathName)));
      } else {
        predicate = predicate.or(path -> path.equals(localExplodedJarRoot.resolve(pathName)));
      }
    }
    return predicate.and(Files::isRegularFile);
  }
Creates layers as specified by the layers.idx file (located in the BOOT-INF/ directory of the
JAR).

@param localExplodedJarRoot Path to exploded JAR content root
@return list of {@link FileEntriesLayer}
@throws IOException when an IO error occurs
jib-cli/src/main/java/com/google/cloud/tools/jib/cli/jar/SpringBootExplodedProcessor.java