diff --git a/cnd.utils/src/org/netbeans/modules/cnd/utils/cache/WeakSharedSet.java b/openide.util/src/org/openide/util/WeakSet.java rename from cnd.utils/src/org/netbeans/modules/cnd/utils/cache/WeakSharedSet.java rename to openide.util/src/org/openide/util/WeakSet.java --- a/cnd.utils/src/org/netbeans/modules/cnd/utils/cache/WeakSharedSet.java +++ b/openide.util/src/org/openide/util/WeakSet.java @@ -42,10 +42,10 @@ * made subject to such option by the copyright holder. */ /* - * @(#)WeakSharedSet.java 0.2 07/02/26 + * @(#)WeakSet.java 0.2 07/02/26 */ -package org.netbeans.modules.cnd.utils.cache; +package org.openide.util; import java.io.IOException; import java.lang.ref.ReferenceQueue; @@ -71,54 +71,54 @@ * @author Vladimir Voskresensky */ @SuppressWarnings("unchecked") -public class WeakSharedSet extends AbstractSet implements Set { +public class WeakSet extends AbstractSet implements Set { private final SharedKeyWeakHashMap m; // The backing map private transient Set s; // Its keySet /** - * Constructs a new, empty WeakSharedSet with the given initial + * Constructs a new, empty WeakSet with the given initial * capacity and the given load factor. * - * @param initialCapacity The initial capacity of the WeakSharedSet - * @param loadFactor The load factor of the WeakSharedSet + * @param initialCapacity The initial capacity of the WeakSet + * @param loadFactor The load factor of the WeakSet * @throws IllegalArgumentException if the initial capacity is negative, * or if the load factor is nonpositive. */ - public WeakSharedSet(int initialCapacity, float loadFactor) { + public WeakSet(int initialCapacity, float loadFactor) { m = new SharedKeyWeakHashMap(initialCapacity, loadFactor); s = m.keySet(); } /** - * Constructs a new, empty WeakSharedSet with the given initial + * Constructs a new, empty WeakSet with the given initial * capacity and the default load factor (0.75). * - * @param initialCapacity The initial capacity of the WeakSharedSet + * @param initialCapacity The initial capacity of the WeakSet * @throws IllegalArgumentException if the initial capacity is negative */ - public WeakSharedSet(int initialCapacity) { + public WeakSet(int initialCapacity) { this(initialCapacity, SharedKeyWeakHashMap.DEFAULT_LOAD_FACTOR); } /** - * Constructs a new, empty WeakSharedSet with the default initial + * Constructs a new, empty WeakSet with the default initial * capacity (16) and load factor (0.75). */ - public WeakSharedSet() { + public WeakSet() { m = new SharedKeyWeakHashMap(); s = m.keySet(); } /** - * Constructs a new WeakSharedSet with the same mappings as the - * specified map. The WeakSharedSet is created with the default + * Constructs a new WeakSet with the same mappings as the + * specified map. The WeakSet is created with the default * load factor (0.75) and an initial capacity sufficient to hold the * mappings in the specified map. * * @param m the map whose mappings are to be placed in this map * @throws NullPointerException if the specified map is null */ - public WeakSharedSet(Set s) { + public WeakSet(Set s) { this(Math.max((int) (s.size() / SharedKeyWeakHashMap.DEFAULT_LOAD_FACTOR) + 1, 16), SharedKeyWeakHashMap.DEFAULT_LOAD_FACTOR); addAll(s); @@ -140,7 +140,7 @@ } /** - * it is expected that method putIfAbsent is used instead of add + * @see #putIfAbsent */ @Override public boolean add(E e) { return m.put(e, null) == null; }