/**
  * Looks up an extra field by its header id.
  *
  * @param type the header id
  * @return null if no such field exists.
  */
 public ZipExtraField getExtraField(ZipShort type) {
   if (extraFields != null) {
     for (ZipExtraField extraField : extraFields) {
       if (type.equals(extraField.getHeaderId())) {
         return extraField;
       }
     }
   }
   return null;
 }
  /**
   * Remove an extra field.
   *
   * @param type the type of extra field to remove
   */
  public void removeExtraField(ZipShort type) {
    if (extraFields == null) {
      throw new java.util.NoSuchElementException();
    }

    List<ZipExtraField> newResult = new ArrayList<ZipExtraField>();
    for (ZipExtraField extraField : extraFields) {
      if (!type.equals(extraField.getHeaderId())) {
        newResult.add(extraField);
      }
    }
    if (extraFields.length == newResult.size()) {
      throw new java.util.NoSuchElementException();
    }
    extraFields = newResult.toArray(new ZipExtraField[newResult.size()]);
    setExtra();
  }