Code example for ConcurrentHashMap

0
     */ 
    public static <K, V> ConcurrentMap<K, V> newConcurrentHashMap() {
        if (CAN_USE_CHM_V8) {
            return new ConcurrentHashMapV8<K, V>(); 
        } else { 
            return new ConcurrentHashMap<K, V>();
        } 
    } 
 
    /** 
     * Creates a new fastest {@link ConcurrentMap} implementaion for the current platform. 
     */ 
    public static <K, V> ConcurrentMap<K, V> newConcurrentHashMap(int initialCapacity) {
        if (CAN_USE_CHM_V8) {
            return new ConcurrentHashMapV8<K, V>(initialCapacity);
        } else { 
            return new ConcurrentHashMap<K, V>(initialCapacity);
        } 
    } 
 
Stop searching for code, let great code find you!  Add Codota to your java IDE