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:07:42 UTC

svn commit: r1378121 - in /lucene/dev/branches/branch_4x: ./ lucene/ lucene/core/ lucene/core/src/java/org/apache/lucene/util/WeakIdentityMap.java

Author: uschindler
Date: Tue Aug 28 13:07:41 2012
New Revision: 1378121

URL: http://svn.apache.org/viewvc?rev=1378121&view=rev
Log:
Merged revision(s) 1378119 from lucene/dev/trunk:
Add javadocs.

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/lucene/   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/WeakIdentityMap.java

Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/WeakIdentityMap.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/WeakIdentityMap.java?rev=1378121&r1=1378120&r2=1378121&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/WeakIdentityMap.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/WeakIdentityMap.java Tue Aug 28 13:07:41 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;