Exemplo n.º 1
0
 private void internalPut(int key, int value) {
   int index = getIndex(key);
   int plus = 1;
   int deleted = -1;
   do {
     int k = keys[index];
     if (k == 0) {
       if (values[index] != DELETED) {
         // found an empty record
         if (deleted >= 0) {
           index = deleted;
           deletedCount--;
         }
         size++;
         keys[index] = key;
         values[index] = value;
         return;
       }
       // found a deleted record
       if (deleted < 0) {
         deleted = index;
       }
     } else if (k == key) {
       // update existing
       values[index] = value;
       return;
     }
     index = (index + plus++) & mask;
   } while (plus <= len);
   // no space
   DbException.throwInternalError("hashmap is full");
 }
 @Override
 public int update() {
   throw DbException.getUnsupportedException("TODO");
 }