package nallar.collections;

import java.util.*;
import java.util.concurrent.*;

/**
 * Concurrent HashMap, which extends HashMap.
 * Necessary as ConcurrentHashMap does not, so it's
 * much harder to replace usages of HashMap with it
 */
public class CHashMap<K, V> extends HashMap<K, V> {
	private static final long serialVersionUID = 7249069246763182397L;
	protected ConcurrentHashMap<K, V> hashMap;

	public CHashMap(int initialCapacity, float loadFactor) {
		hashMap = new ConcurrentHashMap<K, V>(initialCapacity);
	}

	public CHashMap(int initialCapacity) {
		hashMap = new ConcurrentHashMap<K, V>(initialCapacity);
	}

	public CHashMap() {
		hashMap = new ConcurrentHashMap<K, V>();
	}

	public CHashMap(Map<? extends K, ? extends V> m) {
		hashMap = new ConcurrentHashMap<K, V>(m.size());
		hashMap.putAll(m);
	}

	public CHashMap(ConcurrentHashMap<K, V> m) {
		hashMap = m;
	}

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

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

	@Override
	public V get(Object key) {
		return key == null ? null : hashMap.get(key);
	}

	@Override
	public boolean containsKey(Object key) {
		return key != null && hashMap.containsKey(key);
	}

	@Override
	public V put(K key, V value) {
		return (key == null || value == null) ? null : hashMap.put(key, value);
	}

	@Override
	public void putAll(Map<? extends K, ? extends V> m) {
		hashMap.putAll(m);
	}

	@Override
	public V remove(Object key) {
		return key == null ? null : hashMap.remove(key);
	}

	@Override
	public void clear() {
		hashMap.clear();
	}

	@Override
	public boolean containsValue(Object value) {
		return value != null && hashMap.containsValue(value);
	}

	@Override
	public Set<K> keySet() {
		return hashMap.keySet();
	}

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

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

	@SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
	@Override
	public boolean equals(Object o) {
		return hashMap.equals(o);
	}

	@Override
	public int hashCode() {
		return hashMap.hashCode();
	}

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

	public ConcurrentHashMap<K, V> concurrentHashMap() {
		return hashMap;
	}
}

@@ -2303,32 +2303,135 @@
 tring();%0D%0A%09%7D%0D%0A%0D%0A
+%09@Override%0D%0A%09public CHashMap%3CK, V%3E clone() %7B%0D%0A%09%09return new CHashMap%3CK, V%3E((Map%3CK, V%3E) hashMap);%0D%0A%09%7D%0D%0A%0D%0A
 %09public Concurre

Fix CHashMap.clone for #1103