public static List<String> parseListProperty(String property) {
    List<String> items = new ArrayList<>();
    StringBuilder token = new StringBuilder();
    for (int i = 0; i < property.length(); i++) {
      if (property.charAt(i) == ',') {
        // Split on non-escaped comma
        items.add(token.toString());
        token.setLength(0);
      } else {
        if (i + 1 < property.length()
            && property.charAt(i) == '\\'
            && property.charAt(i + 1) == ',') {
          // Found an escaped comma. Add a comma.
          i++;
        }
        token.append(property.charAt(i));
      }
    }
    items.add(token.toString());
    return items;
  }
Parses a comma-separated string into a list. Ignores commas escaped with "\".

@param property the comma-separated string
@return the list of parsed values
jib-plugins-common/src/main/java/com/google/cloud/tools/jib/plugins/common/ConfigurationPropertyValidator.java