public static void checkNullOrNonNullNonEmptyEntries(
      @Nullable Map<String, String> values, String propertyName) {
    if (values == null) {
      // pass
      return;
    }
    for (Map.Entry<String, String> entry : values.entrySet()) {
      Preconditions.checkNotNull(
          entry.getKey(), "Property '" + propertyName + "' cannot contain null keys");
      Preconditions.checkArgument(
          !entry.getKey().trim().isEmpty(),
          "Property '" + propertyName + "' cannot contain empty string keys");
      Preconditions.checkNotNull(
          entry.getValue(), "Property '" + propertyName + "' cannot contain null values");
      Preconditions.checkArgument(
          !entry.getValue().trim().isEmpty(),
          "Property '" + propertyName + "' cannot contain empty string values");
    }
  }
Check if a map is either null, empty or contains only non-null, non-empty keys and values.

@param values the collection in question
@param propertyName the equivalent 'yaml' property name
@throws IllegalArgumentException if {@code values} contains empty keys or values
@throws NullPointerException if {@code values} contains null keys or values
jib-cli/src/main/java/com/google/cloud/tools/jib/cli/buildfile/Validator.java