Exemplo n.º 1
0
 /**
  * Associates key k with value v in bucket with hash value h, returning the previously associated
  * value, if any.
  *
  * @param h the hash value of the relevant bucket
  * @param k the key of interest
  * @param v the value to be associated
  * @return previous value associated with k (or null, if no such entry)
  */
 @Override
 protected V bucketPut(int h, K k, V v) {
   UnsortedTableMap<K, V> bucket = table[h];
   if (bucket == null) bucket = table[h] = new UnsortedTableMap<>();
   int oldSize = bucket.size();
   V answer = bucket.put(k, v);
   n += (bucket.size() - oldSize); // size may have increased
   return answer;
 }