code: public void setHeader(String name, String value)
      {
          boolean found = false;
  
          if ((name == null) || name.equals(""))
              throw new IllegalArgumentException("Illegal MimeHeader name");
  
          for(int i = 0; i < headers.size(); i++) {
              MimeHeader hdr = (MimeHeader) headers.elementAt(i);
              if (hdr.getName().equalsIgnoreCase(name)) {
                  if (!found) {
                      headers.setElementAt(new MimeHeader(hdr.getName(),
                                                          value), i);
                      found = true;
                  }
                  else
                      headers.removeElementAt(i--);
              }
          }
  
          if (!found)
              addHeader(name, value);
      }
docs: Replaces the current value of the first header entry whose name matches
  the given name with the given value, adding a new header if no existing header
  name matches. This method also removes all matching headers after the first one.
  <P>
  Note that RFC822 headers can contain only US-ASCII characters.
  
  @param   name a <code>String</code> with the name of the header for
  which to search
  @param   value a <code>String</code> with the value that will replace the
  current value of the specified header
  
  @exception IllegalArgumentException if there was a problem in the
  mime header name or the value being set
  @see #getHeader