public <K1 extends K, V1 extends V> CopyOnWriteHashMap<K, V> copyAndPutAll(Stream<Entry<K1, V1>> entries) { return copyAndPutAll(entries::iterator); }
/** * Same as {@link #copyAndPut(Object, Object)} but for an arbitrary number of entries. */ public CopyOnWriteHashMap<K, V> copyAndPutAll(Map<? extends K, ? extends V> other) { return copyAndPutAll(other.entrySet()); }
/** * Return a copy of the provided map. */ public static <K, V> CopyOnWriteHashMap<K, V> copyOf(Map<? extends K, ? extends V> map) { if (map instanceof CopyOnWriteHashMap) { // no need to copy in that case @SuppressWarnings("unchecked") final CopyOnWriteHashMap<K, V> cowMap = (CopyOnWriteHashMap<K, V>) map; return cowMap; } else { return new CopyOnWriteHashMap<K, V>().copyAndPutAll(map); } }
public <K1 extends K, V1 extends V> CopyOnWriteHashMap<K, V> copyAndPutAll(Stream<Entry<K1, V1>> entries) { return copyAndPutAll(entries::iterator); }
public <K1 extends K, V1 extends V> CopyOnWriteHashMap<K, V> copyAndPutAll(Stream<Entry<K1, V1>> entries) { return copyAndPutAll(entries::iterator); }
public <K1 extends K, V1 extends V> CopyOnWriteHashMap<K, V> copyAndPutAll(Stream<Entry<K1, V1>> entries) { return copyAndPutAll(entries::iterator); }
/** * Same as {@link #copyAndPut(Object, Object)} but for an arbitrary number of entries. */ public CopyOnWriteHashMap<K, V> copyAndPutAll(Map<? extends K, ? extends V> other) { return copyAndPutAll(other.entrySet()); }
/** * Same as {@link #copyAndPut(Object, Object)} but for an arbitrary number of entries. */ public CopyOnWriteHashMap<K, V> copyAndPutAll(Map<? extends K, ? extends V> other) { return copyAndPutAll(other.entrySet()); }
/** * Same as {@link #copyAndPut(Object, Object)} but for an arbitrary number of entries. */ public CopyOnWriteHashMap<K, V> copyAndPutAll(Map<? extends K, ? extends V> other) { return copyAndPutAll(other.entrySet()); }
/** * Same as {@link #copyAndPut(Object, Object)} but for an arbitrary number of entries. */ public CopyOnWriteHashMap<K, V> copyAndPutAll(Map<? extends K, ? extends V> other) { return copyAndPutAll(other.entrySet()); }
/** * Return a copy of the provided map. */ public static <K, V> CopyOnWriteHashMap<K, V> copyOf(Map<? extends K, ? extends V> map) { if (map instanceof CopyOnWriteHashMap) { // no need to copy in that case @SuppressWarnings("unchecked") final CopyOnWriteHashMap<K, V> cowMap = (CopyOnWriteHashMap<K, V>) map; return cowMap; } else { return new CopyOnWriteHashMap<K, V>().copyAndPutAll(map); } }
/** * Return a copy of the provided map. */ public static <K, V> CopyOnWriteHashMap<K, V> copyOf(Map<? extends K, ? extends V> map) { if (map instanceof CopyOnWriteHashMap) { // no need to copy in that case @SuppressWarnings("unchecked") final CopyOnWriteHashMap<K, V> cowMap = (CopyOnWriteHashMap<K, V>) map; return cowMap; } else { return new CopyOnWriteHashMap<K, V>().copyAndPutAll(map); } }
/** * Return a copy of the provided map. */ public static <K, V> CopyOnWriteHashMap<K, V> copyOf(Map<? extends K, ? extends V> map) { if (map instanceof CopyOnWriteHashMap) { // no need to copy in that case @SuppressWarnings("unchecked") final CopyOnWriteHashMap<K, V> cowMap = (CopyOnWriteHashMap<K, V>) map; return cowMap; } else { return new CopyOnWriteHashMap<K, V>().copyAndPutAll(map); } }
/** * Return a copy of the provided map. */ public static <K, V> CopyOnWriteHashMap<K, V> copyOf(Map<? extends K, ? extends V> map) { if (map instanceof CopyOnWriteHashMap) { // no need to copy in that case @SuppressWarnings("unchecked") final CopyOnWriteHashMap<K, V> cowMap = (CopyOnWriteHashMap<K, V>) map; return cowMap; } else { return new CopyOnWriteHashMap<K, V>().copyAndPutAll(map); } }
/** * Copy the current set and return a copy that is the union of the current * set and <code>entries</code>, potentially replacing existing entries in * case of equality. */ public CopyOnWriteHashSet<T> copyAndAddAll(Collection<? extends T> entries) { final Collection<Entry<T, Boolean>> asMapEntries = Collections2.transform(entries,new Function<T, Map.Entry<T, Boolean>>() { @Override public Entry<T, Boolean> apply(T input) { return Maps.immutableEntry(input, true); } }); CopyOnWriteHashMap<T, Boolean> updated = this.map.copyAndPutAll(asMapEntries); return new CopyOnWriteHashSet<>(updated); }