code: private void setFieldIf(int key, String value, String undef) {
      if (value == null) {
        this.fields[key] = value;
      } else {
        // Special case for language: replace BCP 47 field "root" with undefined value.
        if (key == LANGUAGE && value.equals("root")) {
          this.fields[key] = null;
        } else {
          this.fields[key] = value.equals("") || value.equals(undef) ? null : value;
        }
      }
    }
docs: All public set methods pass through here.