static Map<String, FilePermissions> convertPermissionsList(
      List<PermissionConfiguration> permissionList) {
    // Order is important, so use a LinkedHashMap
    Map<String, FilePermissions> permissionsMap = new LinkedHashMap<>();
    for (PermissionConfiguration permission : permissionList) {
      Optional<String> file = permission.getFile();
      Optional<String> mode = permission.getMode();
      if (!file.isPresent() || !mode.isPresent()) {
        throw new IllegalArgumentException(
            "Incomplete <permission> configuration; requires <file> and <mode> fields to be set");
      }
      permissionsMap.put(file.get(), FilePermissions.fromOctalString(mode.get()));
    }
    return permissionsMap;
  }
Converts a list of {@link PermissionConfiguration} to an equivalent {@code
String->FilePermission} map.

@param permissionList the list to convert
@return the resulting map
jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/MojoCommon.java