You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2012/08/28 15:04:59 UTC
svn commit: r1378119 -
/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/WeakIdentityMap.java
Author: uschindler
Date: Tue Aug 28 13:04:58 2012
New Revision: 1378119
URL: http://svn.apache.org/viewvc?rev=1378119&view=rev
Log:
Add javadocs.
Modified:
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/WeakIdentityMap.java
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/WeakIdentityMap.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/WeakIdentityMap.java?rev=1378119&r1=1378118&r2=1378119&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/WeakIdentityMap.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/WeakIdentityMap.java Tue Aug 28 13:04:58 2012
@@ -65,35 +65,51 @@ public final class WeakIdentityMap<K,V>
this.backingStore = backingStore;
}
+ /** Removes all of the mappings from this map. */
public void clear() {
backingStore.clear();
reap();
}
+ /** Returns {@code true} if this map contains a mapping for the specified key. */
public boolean containsKey(Object key) {
reap();
return backingStore.containsKey(new IdentityWeakReference(key, null));
}
+ /** Returns the value to which the specified key is mapped. */
public V get(Object key) {
reap();
return backingStore.get(new IdentityWeakReference(key, null));
}
+ /** Associates the specified value with the specified key in this map.
+ * If the map previously contained a mapping for this key, the old value
+ * is replaced. */
public V put(K key, V value) {
reap();
return backingStore.put(new IdentityWeakReference(key, queue), value);
}
+ /** Returns {@code true} if this map contains no key-value mappings. */
public boolean isEmpty() {
return size() == 0;
}
+ /** Removes the mapping for a key from this weak hash map if it is present.
+ * Returns the value to which this map previously associated the key,
+ * or {@code null} if the map contained no mapping for the key.
+ * A return value of {@code null} does not necessarily indicate that
+ * the map contained.*/
public V remove(Object key) {
reap();
return backingStore.remove(new IdentityWeakReference(key, null));
}
+ /** Returns the number of key-value mappings in this map. This result is a snapshot,
+ * and may not reflect unprocessed entries that will be removed before next
+ * attempted access because they are no longer referenced.
+ */
public int size() {
if (backingStore.isEmpty())
return 0;