@CanIgnoreReturnValue Builder<K, V> combine(Builder<K, V> other) { checkNotNull(other); ensureCapacity(this.size + other.size); System.arraycopy(other.entries, 0, this.entries, this.size, other.size); this.size += other.size; return this; }
/** * Adds all of the given entries to the built map. Duplicate keys are not allowed, and will * cause {@link #build} to fail. * * @throws NullPointerException if any key, value, or entry is null * @since 19.0 */ @CanIgnoreReturnValue @Beta public Builder<K, V> putAll(Iterable<? extends Entry<? extends K, ? extends V>> entries) { if (entries instanceof Collection) { ensureCapacity(size + ((Collection<?>) entries).size()); } for (Entry<? extends K, ? extends V> entry : entries) { put(entry); } return this; }
@CanIgnoreReturnValue Builder<K, V> combine(Builder<K, V> other) { checkNotNull(other); ensureCapacity(this.size + other.size); System.arraycopy(other.entries, 0, this.entries, this.size, other.size); this.size += other.size; return this; }
/** * Associates all of the given map's keys and values in the built map. * Duplicate keys are not allowed, and will cause {@link #build} to fail. * * @throws NullPointerException if any key or value in {@code map} is null */ public Builder<K, V> putAll(Map<? extends K, ? extends V> map) { ensureCapacity(size + map.size()); for (Entry<? extends K, ? extends V> entry : map.entrySet()) { put(entry); } return this; }
/** * Associates {@code key} with {@code value} in the built map. Duplicate * keys are not allowed, and will cause {@link #build} to fail. */ public Builder<K, V> put(K key, V value) { ensureCapacity(size + 1); ImmutableMapEntry<K, V> entry = entryOf(key, value); // don't inline this: we want to fail atomically if key or value is null entries[size++] = entry; return this; }
/** * Associates {@code key} with {@code value} in the built map. Duplicate * keys are not allowed, and will cause {@link #build} to fail. */ public Builder<K, V> put(K key, V value) { ensureCapacity(size + 1); TerminalEntry<K, V> entry = entryOf(key, value); // don't inline this: we want to fail atomically if key or value is null entries[size++] = entry; return this; }
/** * Associates all of the given map's keys and values in the built map. * Duplicate keys are not allowed, and will cause {@link #build} to fail. * * @throws NullPointerException if any key or value in {@code map} is null */ public Builder<K, V> putAll(Map<? extends K, ? extends V> map) { ensureCapacity(size + map.size()); for (Entry<? extends K, ? extends V> entry : map.entrySet()) { put(entry); } return this; }
/** * Associates all of the given map's keys and values in the built map. * Duplicate keys are not allowed, and will cause {@link #build} to fail. * * @throws NullPointerException if any key or value in {@code map} is null */ public Builder<K, V> putAll(Map<? extends K, ? extends V> map) { ensureCapacity(size + map.size()); for (Entry<? extends K, ? extends V> entry : map.entrySet()) { put(entry); } return this; }
/** * Associates all of the given map's keys and values in the built map. * Duplicate keys are not allowed, and will cause {@link #build} to fail. * * @throws NullPointerException if any key or value in {@code map} is null */ public Builder<K, V> putAll(Map<? extends K, ? extends V> map) { ensureCapacity(size + map.size()); for (Entry<? extends K, ? extends V> entry : map.entrySet()) { put(entry); } return this; }
/** * Associates {@code key} with {@code value} in the built map. Duplicate * keys are not allowed, and will cause {@link #build} to fail. */ public Builder<K, V> put(K key, V value) { ensureCapacity(size + 1); TerminalEntry<K, V> entry = entryOf(key, value); // don't inline this: we want to fail atomically if key or value is null entries[size++] = entry; return this; }
/** * Associates {@code key} with {@code value} in the built map. Duplicate * keys are not allowed, and will cause {@link #build} to fail. */ public Builder<K, V> put(K key, V value) { ensureCapacity(size + 1); TerminalEntry<K, V> entry = entryOf(key, value); // don't inline this: we want to fail atomically if key or value is null entries[size++] = entry; return this; }
@CanIgnoreReturnValue Builder<K, V> combine(Builder<K, V> other) { checkNotNull(other); ensureCapacity(this.size + other.size); System.arraycopy(other.entries, 0, this.entries, this.size, other.size); this.size += other.size; return this; }
@CanIgnoreReturnValue Builder<K, V> combine(Builder<K, V> other) { checkNotNull(other); ensureCapacity(this.size + other.size); System.arraycopy(other.entries, 0, this.entries, this.size, other.size); this.size += other.size; return this; }
/** * Associates {@code key} with {@code value} in the built map. Duplicate keys are not allowed, * and will cause {@link #build} to fail. */ @CanIgnoreReturnValue public Builder<K, V> put(K key, V value) { ensureCapacity(size + 1); Entry<K, V> entry = entryOf(key, value); // don't inline this: we want to fail atomically if key or value is null entries[size++] = entry; return this; }
/** * Associates {@code key} with {@code value} in the built map. Duplicate * keys are not allowed, and will cause {@link #build} to fail. */ public Builder<K, V> put(K key, V value) { ensureCapacity(size + 1); TerminalEntry<K, V> entry = entryOf(key, value); // don't inline this: we want to fail atomically if key or value is null entries[size++] = entry; return this; }
/** * Associates {@code key} with {@code value} in the built map. Duplicate keys are not allowed, * and will cause {@link #build} to fail. */ @CanIgnoreReturnValue public Builder<K, V> put(K key, V value) { ensureCapacity(size + 1); Entry<K, V> entry = entryOf(key, value); // don't inline this: we want to fail atomically if key or value is null entries[size++] = entry; return this; }
public Builder<K, V> putAll(Iterable<? extends Entry<? extends K, ? extends V>> entries) { if (entries instanceof Collection) { ensureCapacity(size + ((Collection<?>) entries).size());
/** * Adds all of the given entries to the built map. Duplicate keys are not allowed, and will * cause {@link #build} to fail. * * @throws NullPointerException if any key, value, or entry is null * @since 19.0 */ @CanIgnoreReturnValue @Beta public Builder<K, V> putAll(Iterable<? extends Entry<? extends K, ? extends V>> entries) { if (entries instanceof Collection) { ensureCapacity(size + ((Collection<?>) entries).size()); } for (Entry<? extends K, ? extends V> entry : entries) { put(entry); } return this; }
/** * Associates {@code key} with {@code value} in the built map. Duplicate keys are not allowed, * and will cause {@link #build} to fail. */ @CanIgnoreReturnValue public Builder<K, V> put(K key, V value) { ensureCapacity(size + 1); Entry<K, V> entry = entryOf(key, value); // don't inline this: we want to fail atomically if key or value is null entries[size++] = entry; return this; }
/** * Associates {@code key} with {@code value} in the built map. Duplicate keys are not allowed, * and will cause {@link #build} to fail. */ @CanIgnoreReturnValue public Builder<K, V> put(K key, V value) { ensureCapacity(size + 1); Entry<K, V> entry = entryOf(key, value); // don't inline this: we want to fail atomically if key or value is null entries[size++] = entry; return this; }