class CopyOnWriteHashMap<K, V> extends ConcurrentHashMap<K, V> {

	volatile ConcurrentHashMap<K, V> view;

	private ConcurrentHashMap<K, V> duplicate(ConcurrentHashMap<K, V> original) {<FILL_FUNCTION_BODY>}

	public CopyOnWriteHashMap(ConcurrentHashMap<K, V> that) {
		this.view = duplicate(that);
	}

	public CopyOnWriteHashMap() {
		this(new ConcurrentHashMap<>());
	}

	@Override
	public CopyOnWriteHashMap<K, V> clone() {
		return new CopyOnWriteHashMap(view);
	}

	/*
	 * ********************** READ-ONLY OPERATIONS
	 **********************/

	@Override
	public int size() {
		return view.size();
	}

	@Override
	public boolean isEmpty() {
		return view.isEmpty();
	}

	@Override
	public boolean containsKey(Object key) {
		return view.containsKey(key);
	}

	@Override
	public boolean containsValue(Object value) {
		return view.containsValue(value);
	}

	@Override
	public V get(Object key) {
		return view.get(key);
	}

	@Override
	public KeySetView<K, V> keySet() {
		return view.keySet();
	}

	@Override
	public Collection<V> values() {
		return view.values();
	}

	@Override
	public Set<Map.Entry<K, V>> entrySet() {
		return view.entrySet();
	}

	@Override
	public String toString() {
		return view.toString();
	}

	/*
	 * ********************** UPDATING OPERATIONS
	 *
	 * These operations all follow a common pattern:
	 *
	 * 1. Create a copy of the existing view. 2. Update the copy. 3. Perform a volatile
	 * write to replace the existing view.
	 *
	 * Note that if you are not concerned about lost updates, you could dispense with the
	 * synchronization entirely.
	 **********************/

	@Override
	public V put(K key, V value) {
		synchronized (this) {
			ConcurrentHashMap<K, V> newCore = duplicate(view);
			V result = newCore.put(key, value);
			view = newCore; // volatile write
			return result;
		}
	}

	@Override
	public V remove(Object key) {
		synchronized (this) {
			ConcurrentHashMap<K, V> newCore = duplicate(view);
			V result = newCore.remove(key);
			view = newCore; // volatile write
			return result;
		}
	}

	@Override
	public void putAll(Map<? extends K, ? extends V> t) {
		synchronized (this) {
			ConcurrentHashMap<K, V> newCore = duplicate(view);
			newCore.putAll(t);
			view = newCore; // volatile write
		}
	}

	@Override
	public void clear() {
		synchronized (this) {
			view = new ConcurrentHashMap<>(); // volatile write
		}
	}

}

		// SUBTLETY: note that original.entrySet() grabs the entire contents of the
		// original Map in a
		// single call. This means that if the original map is Thread-safe or another
		// CopyOnWriteHashMap,
		// we can safely iterate over the list of entries.
		return new ConcurrentHashMap<>(original);
	
<methods>public void <init>() ,public void <init>(int) ,public void <init>(Map<? extends K,? extends V>) ,public void <init>(int, float) ,public void <init>(int, float, int) ,public void clear() ,public V compute(K, BiFunction<? super K,? super V,? extends V>) ,public V computeIfAbsent(K, Function<? super K,? extends V>) ,public V computeIfPresent(K, BiFunction<? super K,? super V,? extends V>) ,public boolean contains(java.lang.Object) ,public boolean containsKey(java.lang.Object) ,public boolean containsValue(java.lang.Object) ,public Enumeration<V> elements() ,public Set<Entry<K,V>> entrySet() ,public boolean equals(java.lang.Object) ,public void forEach(BiConsumer<? super K,? super V>) ,public void forEach(long, BiConsumer<? super K,? super V>) ,public void forEach(long, BiFunction<? super K,? super V,? extends U>, Consumer<? super U>) ,public void forEachEntry(long, Consumer<? super Entry<K,V>>) ,public void forEachEntry(long, Function<Entry<K,V>,? extends U>, Consumer<? super U>) ,public void forEachKey(long, Consumer<? super K>) ,public void forEachKey(long, Function<? super K,? extends U>, Consumer<? super U>) ,public void forEachValue(long, Consumer<? super V>) ,public void forEachValue(long, Function<? super V,? extends U>, Consumer<? super U>) ,public V get(java.lang.Object) ,public V getOrDefault(java.lang.Object, V) ,public int hashCode() ,public boolean isEmpty() ,public KeySetView<K,V> keySet() ,public KeySetView<K,V> keySet(V) ,public Enumeration<K> keys() ,public long mappingCount() ,public V merge(K, V, BiFunction<? super V,? super V,? extends V>) ,public static KeySetView<K,java.lang.Boolean> newKeySet() ,public static KeySetView<K,java.lang.Boolean> newKeySet(int) ,public V put(K, V) ,public void putAll(Map<? extends K,? extends V>) ,public V putIfAbsent(K, V) ,public U reduce(long, BiFunction<? super K,? super V,? extends U>, BiFunction<? super U,? super U,? extends U>) ,public Entry<K,V> reduceEntries(long, BiFunction<Entry<K,V>,Entry<K,V>,? extends Entry<K,V>>) ,public U reduceEntries(long, Function<Entry<K,V>,? extends U>, BiFunction<? super U,? super U,? extends U>) ,public double reduceEntriesToDouble(long, ToDoubleFunction<Entry<K,V>>, double, java.util.function.DoubleBinaryOperator) ,public int reduceEntriesToInt(long, ToIntFunction<Entry<K,V>>, int, java.util.function.IntBinaryOperator) ,public long reduceEntriesToLong(long, ToLongFunction<Entry<K,V>>, long, java.util.function.LongBinaryOperator) ,public K reduceKeys(long, BiFunction<? super K,? super K,? extends K>) ,public U reduceKeys(long, Function<? super K,? extends U>, BiFunction<? super U,? super U,? extends U>) ,public double reduceKeysToDouble(long, ToDoubleFunction<? super K>, double, java.util.function.DoubleBinaryOperator) ,public int reduceKeysToInt(long, ToIntFunction<? super K>, int, java.util.function.IntBinaryOperator) ,public long reduceKeysToLong(long, ToLongFunction<? super K>, long, java.util.function.LongBinaryOperator) ,public double reduceToDouble(long, ToDoubleBiFunction<? super K,? super V>, double, java.util.function.DoubleBinaryOperator) ,public int reduceToInt(long, ToIntBiFunction<? super K,? super V>, int, java.util.function.IntBinaryOperator) ,public long reduceToLong(long, ToLongBiFunction<? super K,? super V>, long, java.util.function.LongBinaryOperator) ,public V reduceValues(long, BiFunction<? super V,? super V,? extends V>) ,public U reduceValues(long, Function<? super V,? extends U>, BiFunction<? super U,? super U,? extends U>) ,public double reduceValuesToDouble(long, ToDoubleFunction<? super V>, double, java.util.function.DoubleBinaryOperator) ,public int reduceValuesToInt(long, ToIntFunction<? super V>, int, java.util.function.IntBinaryOperator) ,public long reduceValuesToLong(long, ToLongFunction<? super V>, long, java.util.function.LongBinaryOperator) ,public V remove(java.lang.Object) ,public boolean remove(java.lang.Object, java.lang.Object) ,public V replace(K, V) ,public boolean replace(K, V, V) ,public void replaceAll(BiFunction<? super K,? super V,? extends V>) ,public U search(long, BiFunction<? super K,? super V,? extends U>) ,public U searchEntries(long, Function<Entry<K,V>,? extends U>) ,public U searchKeys(long, Function<? super K,? extends U>) ,public U searchValues(long, Function<? super V,? extends U>) ,public int size() ,public java.lang.String toString() ,public Collection<V> values() <variables>private static final int ABASE,private static final int ASHIFT,private static final long BASECOUNT,private static final long CELLSBUSY,private static final long CELLVALUE,private static final int DEFAULT_CAPACITY,private static final int DEFAULT_CONCURRENCY_LEVEL,static final int HASH_BITS,private static final float LOAD_FACTOR,private static final int MAXIMUM_CAPACITY,static final int MAX_ARRAY_SIZE,private static final int MAX_RESIZERS,private static final int MIN_TRANSFER_STRIDE,static final int MIN_TREEIFY_CAPACITY,static final int MOVED,static final int NCPU,static final int RESERVED,private static final int RESIZE_STAMP_BITS,private static final int RESIZE_STAMP_SHIFT,private static final long SIZECTL,private static final long TRANSFERINDEX,static final int TREEBIN,static final int TREEIFY_THRESHOLD,private static final jdk.internal.misc.Unsafe U,static final int UNTREEIFY_THRESHOLD,private volatile transient long baseCount,private volatile transient int cellsBusy,private volatile transient java.util.concurrent.ConcurrentHashMap.CounterCell[] counterCells,private transient EntrySetView<K,V> entrySet,private transient KeySetView<K,V> keySet,private volatile transient Node<K,V>[] nextTable,private static final java.io.ObjectStreamField[] serialPersistentFields,private static final long serialVersionUID,private volatile transient int sizeCtl,volatile transient Node<K,V>[] table,private volatile transient int transferIndex,private transient ValuesView<K,V> values