@VisibleForTesting
  @Nullable
  static ImmutableList<String> environmentMapToList(@Nullable Map<String, String> environment) {
    if (environment == null) {
      return null;
    }
    Preconditions.checkArgument(
        environment.keySet().stream().noneMatch(key -> key.contains("=")),
        "Illegal environment variable: name cannot contain '='");
    return environment.entrySet().stream()
        .map(entry -> entry.getKey() + "=" + entry.getValue())
        .collect(ImmutableList.toImmutableList());
  }
Converts the map of environment variables to a list with items in the format "NAME=VALUE".

@return the list
jib-core/src/main/java/com/google/cloud/tools/jib/image/json/ImageToJsonTranslator.java