home *** CD-ROM | disk | FTP | other *** search
- package java.util;
-
- import java.lang.ref.ReferenceQueue;
-
- public class WeakHashMap extends AbstractMap implements Map {
- private Map hash;
- private ReferenceQueue queue;
- private Set entrySet;
-
- private void processQueue() {
- WeakKey var1;
- while((var1 = (WeakKey)this.queue.poll()) != null) {
- this.hash.remove(var1);
- }
-
- }
-
- public WeakHashMap(int var1, float var2) {
- this.queue = new ReferenceQueue();
- this.entrySet = null;
- this.hash = new HashMap(var1, var2);
- }
-
- public WeakHashMap(int var1) {
- this.queue = new ReferenceQueue();
- this.entrySet = null;
- this.hash = new HashMap(var1);
- }
-
- public WeakHashMap() {
- this.queue = new ReferenceQueue();
- this.entrySet = null;
- this.hash = new HashMap();
- }
-
- public WeakHashMap(Map var1) {
- this(Math.max(2 * var1.size(), 11), 0.75F);
- ((AbstractMap)this).putAll(var1);
- }
-
- public int size() {
- return this.entrySet().size();
- }
-
- public boolean isEmpty() {
- return this.entrySet().isEmpty();
- }
-
- public boolean containsKey(Object var1) {
- return this.hash.containsKey(java.util.WeakHashMap.WeakKey.access$000(var1));
- }
-
- public Object get(Object var1) {
- return this.hash.get(java.util.WeakHashMap.WeakKey.access$000(var1));
- }
-
- public Object put(Object var1, Object var2) {
- this.processQueue();
- return this.hash.put(java.util.WeakHashMap.WeakKey.access$100(var1, this.queue), var2);
- }
-
- public Object remove(Object var1) {
- this.processQueue();
- return this.hash.remove(java.util.WeakHashMap.WeakKey.access$000(var1));
- }
-
- public void clear() {
- this.processQueue();
- this.hash.clear();
- }
-
- public Set entrySet() {
- if (this.entrySet == null) {
- this.entrySet = new EntrySet(this, (1)null);
- }
-
- return this.entrySet;
- }
-
- // $FF: synthetic method
- static Map access$200(WeakHashMap var0) {
- return var0.hash;
- }
-
- // $FF: synthetic method
- static void access$300(WeakHashMap var0) {
- var0.processQueue();
- }
- }
-