Here you can find the source of createConcurrentHashMap()
Parameter | Description |
---|---|
K | a parameter |
V | a parameter |
public static final <K, V> ConcurrentHashMap<K, V> createConcurrentHashMap()
//package com.java2s; /*//from w w w . j av a 2s . c o m * Copyright 2004 - 2008 Christian Sprajc. All rights reserved. * * This file is part of PowerFolder. * * PowerFolder is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation. * * PowerFolder is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with PowerFolder. If not, see <http://www.gnu.org/licenses/>. * * $Id: Util.java 20555 2012-12-25 04:15:08Z glasgow $ */ import java.util.concurrent.ConcurrentHashMap; public class Main { /** * Creates a concurrent map with lesser segements to save memory. The * default concurrency of the maps are 4 (instead of 16 default). * <p> * 4 should be more suitable value for in-powerfolder us and procudes lesser * Segements. * * @param <K> * @param <V> * @return the concurrent hashmap */ public static final <K, V> ConcurrentHashMap<K, V> createConcurrentHashMap() { return createConcurrentHashMap(16); } /** * Creates a concurrent map with lesser segements to save memory. The * default concurrency of the maps are 4 (instead of 16 default). * <p> * 4 should be more suitable value for in-powerfolder us and procudes lesser * Segements. * * @param <K> * @param <V> * @param intialSize * the initial size of the map. * @return the concurrent hashmap */ public static final <K, V> ConcurrentHashMap<K, V> createConcurrentHashMap(int intialSize) { return new ConcurrentHashMap<K, V>(intialSize, 0.75f, 4); } }