/** * Copies all of the mappings from {@code other} to this map. * * @since 1.0 */ default void putAll(UnmodifiableEconomicMap<? extends K, ? extends V> other) { UnmodifiableMapCursor<? extends K, ? extends V> entry = other.getEntries(); while (entry.advance()) { put(entry.getKey(), entry.getValue()); } }
/** * Copies all of the mappings from {@code other} to this map. * * @since 1.0 */ default void putAll(EconomicMap<K, V> other) { MapCursor<K, V> e = other.getEntries(); while (e.advance()) { put(e.getKey(), e.getValue()); } }
/** * Creates a new map that guarantees insertion order on the key set with the default * {@link Equivalence#DEFAULT} comparison strategy for keys. * * @since 1.0 */ static <K, V> EconomicMap<K, V> create() { return EconomicMap.create(Equivalence.DEFAULT); }
private void setValue(int index, Object newValue) { Object oldValue = getRawValue(index); if (oldValue instanceof CollisionLink) { CollisionLink collisionLink = (CollisionLink) oldValue; setRawValue(index, new CollisionLink(newValue, collisionLink.next)); } else { setRawValue(index, newValue); } }
private int find(K key) { if (hasHashArray()) { return findHash(key); } else { return findLinear(key); } }
/** * Creates a new map that guarantees insertion order on the key set and copies all elements from * the specified existing map. * * @since 1.0 */ static <K, V> EconomicMap<K, V> create(Equivalence strategy, UnmodifiableEconomicMap<K, V> m) { return EconomicMapImpl.create(strategy, m, false); }
@Override public void remove(K element) { removeKey(element); } }
/** * Copies all of the mappings from {@code other} to this map. * * @since 1.0 */ default void putAll(UnmodifiableEconomicMap<? extends K, ? extends V> other) { UnmodifiableMapCursor<? extends K, ? extends V> entry = other.getEntries(); while (entry.advance()) { put(entry.getKey(), entry.getValue()); } }
/** * Copies all of the mappings from {@code other} to this map. * * @since 1.0 */ default void putAll(EconomicMap<K, V> other) { MapCursor<K, V> e = other.getEntries(); while (e.advance()) { put(e.getKey(), e.getValue()); } }
/** * Creates a new map that guarantees insertion order on the key set with the default * {@link Equivalence#DEFAULT} comparison strategy for keys. * * @since 1.0 */ static <K, V> EconomicMap<K, V> create() { return EconomicMap.create(Equivalence.DEFAULT); }
private void setValue(int index, Object newValue) { Object oldValue = getRawValue(index); if (oldValue instanceof CollisionLink) { CollisionLink collisionLink = (CollisionLink) oldValue; setRawValue(index, new CollisionLink(newValue, collisionLink.next)); } else { setRawValue(index, newValue); } }
/** * Creates a new set guaranteeing insertion order when iterating over its elements and * initializes with the given capacity. * * @since 1.0 */ static <E> EconomicSet<E> create(Equivalence strategy, int initialCapacity) { return EconomicMapImpl.create(strategy, initialCapacity, true); }
public OptionValuesImpl( final OptionDescriptors descriptors, final UnmodifiableEconomicMap<OptionKey<?>, Object> values) { this.descriptors = descriptors; this.values = EconomicMap.create(); final UnmodifiableMapCursor<OptionKey<?>, Object> cursor = values.getEntries(); while (cursor.advance()) { this.values.put(cursor.getKey(), maskNull(cursor.getValue())); } }
/** * Creates a new map that guarantees insertion order on the key set with the default * {@link Equivalence#DEFAULT} comparison strategy for keys and copies all elements from the * specified existing map. * * @since 1.0 */ static <K, V> EconomicMap<K, V> create(UnmodifiableEconomicMap<K, V> m) { return EconomicMap.create(Equivalence.DEFAULT, m); }
/** * Creates a new map that guarantees insertion order on the key set and initializes with a * specified capacity. * * @since 1.0 */ static <K, V> EconomicMap<K, V> create(Equivalence strategy, int initialCapacity) { return EconomicMapImpl.create(strategy, initialCapacity, false); }
protected static void initMap(EconomicMap<OptionKey<?>, Object> map, UnmodifiableEconomicMap<OptionKey<?>, Object> values) { UnmodifiableMapCursor<OptionKey<?>, Object> cursor = values.getEntries(); while (cursor.advance()) { map.put(cursor.getKey(), encodeNull(cursor.getValue())); } }