1 10 11 package com.triactive.jdo.util; 12 13 import java.lang.ref.ReferenceQueue ; 14 import java.lang.ref.WeakReference ; 15 import java.util.Map ; 16 17 18 30 31 public class WeakValueMap extends ReferenceValueMap 32 { 33 public WeakValueMap() 34 { 35 super(); 36 } 37 38 39 public WeakValueMap(int initialCapacity) 40 { 41 super(initialCapacity); 42 } 43 44 45 public WeakValueMap(int initialCapacity, float loadFactor) 46 { 47 super(initialCapacity, loadFactor); 48 } 49 50 51 public WeakValueMap(Map m) 52 { 53 super(m); 54 } 55 56 57 private static class WeakValueReference extends WeakReference implements ReferenceValueMap.ValueReference 58 { 59 private final Object key; 60 61 WeakValueReference(Object key, Object value, ReferenceQueue q) 62 { 63 super(value, q); 64 this.key = key; 65 } 66 67 public Object getKey() 68 { 69 return key; 70 } 71 } 72 73 protected ReferenceValueMap.ValueReference newValueReference(Object key, Object value, ReferenceQueue queue) 74 { 75 return new WeakValueReference(key, value, queue); 76 } 77 } 78 | Popular Tags |