public synchronized void remove(String k){
  if (k == null) {
    for (int i=0; i < nkeys; i++) {
      while (keys[i] == null && i < nkeys) {
        for (int j=i; j < nkeys - 1; j++) {
          keys[j]=keys[j + 1];
          values[j]=values[j + 1];
        }
        nkeys--;
      }
    }
  }
 else {
    for (int i=0; i < nkeys; i++) {
      while (k.equalsIgnoreCase(keys[i]) && i < nkeys) {
        for (int j=i; j < nkeys - 1; j++) {
          keys[j]=keys[j + 1];
          values[j]=values[j + 1];
        }
        nkeys--;
      }
    }
  }
}

public synchronized void remove ( String k ) { if ( k == null ) { for ( int i = 0 ; i < nkeys ; i ++ ) { while ( keys [ i ] == null && i < nkeys ) { for ( int j = i ; j < nkeys - 1 ; j ++ ) { keys [ j ] = keys [ j + 1 ] ; values [ j ] = values [ j + 1 ] ; } nkeys -- ; } } } else { for ( int i = 0 ; i < nkeys ; i ++ ) { while ( k . equalsIgnoreCase ( keys [ i ] ) && i < nkeys ) { for ( int j = i ; j < nkeys - 1 ; j ++ ) { keys [ j ] = keys [ j + 1 ] ; values [ j ] = values [ j + 1 ] ; } nkeys -- ; } } } }
remove the key from the header . if there are multiple values under the same key , they are all removed . nothing is done if the key doesn ' t exist . after a remove , the other pairs ' order are not changed .
