Exemple #1
0
 /**
  * Perform a {@link #put(Object, Object)} of all key/value pairs in <var>map</var>
  *
  * @param map The map whose contents are to be retrieved.
  */
 @Override
 public void putAll(Map<? extends K, ? extends V> map) {
   ensureCapacity(mSize + map.size());
   for (Map.Entry<? extends K, ? extends V> entry : map.entrySet()) {
     put(entry.getKey(), entry.getValue());
   }
 }
Exemple #2
0
 /**
  * Perform a {@link #put(Object, Object)} of all key/value pairs in <var>array</var>
  *
  * @param array The array whose contents are to be retrieved.
  */
 public void putAll(ArrayMap<? extends K, ? extends V> array) {
   final int N = array.mSize;
   ensureCapacity(mSize + N);
   if (mSize == 0) {
     if (N > 0) {
       System.arraycopy(array.mHashes, 0, mHashes, 0, N);
       System.arraycopy(array.mArray, 0, mArray, 0, N << 1);
       mSize = N;
     }
   } else {
     for (int i = 0; i < N; i++) {
       put(array.keyAt(i), array.valueAt(i));
     }
   }
 }