/** * Constructs a new set containing the elements in the specified collection. The * <tt>ConcurrentHashMap</tt> is created with default load factor (0.75) and an initial capacity * sufficient to contain the elements in the specified collection. * * @param c * the collection whose elements are to be placed into this set. * @throws NullPointerException * if the specified collection is null. */ public ConcurrentHashSet(final Collection<? extends E> c) { map = new ConcurrentHashMap<>(Math.max((int)(c.size() / .75f) + 1, 16)); addAll(c); }
/** * Constructs a new set containing the elements in the specified collection. The * <tt>ConcurrentHashMap</tt> is created with default load factor (0.75) and an initial capacity * sufficient to contain the elements in the specified collection. * * @param c * the collection whose elements are to be placed into this set. * @throws NullPointerException * if the specified collection is null. */ public ConcurrentHashSet(Collection<? extends E> c) { map = new ConcurrentHashMap<E, Object>(Math.max((int)(c.size() / .75f) + 1, 16)); addAll(c); }