コード例 #1
0
 internal Entry(K key, V objectJ, java.lang.refj.ReferenceQueue <K> queue, WeakHashMap <K, V> outer) :
     base(key, queue)
 {
     isNull             = key == null;
     hash               = isNull ? 0 : key.GetHashCode();
     valueJ             = objectJ;
     this.outerInstance = outer;
 }
コード例 #2
0
 /**
  * Constructs a new {@code WeakHashMap} instance with the specified capacity
  * and load factor.
  *
  * @param capacity
  *            the initial capacity of this map.
  * @param loadFactor
  *            the initial load factor.
  * @throws IllegalArgumentException
  *             if the capacity is less than zero or the load factor is less
  *             or equal to zero.
  */
 public WeakHashMap(int capacity, float loadFactor)
 {
     if (capacity >= 0 && loadFactor > 0)
     {
         elementCount    = 0;
         elementData     = newEntryArray <K, V>(capacity == 0 ? 1 : capacity);
         this.loadFactor = (int)(loadFactor * 10000);
         computeMaxSize();
         referenceQueue = new java.lang.refj.ReferenceQueue <K>();
     }
     else
     {
         throw new java.lang.IllegalArgumentException();
     }
 }
コード例 #3
0
 /**
  * Constructs a new {@code WeakHashMap} instance with the specified
  * capacity.
  *
  * @param capacity
  *            the initial capacity of this map.
  * @throws IllegalArgumentException
  *                if the capacity is less than zero.
  */
 public WeakHashMap(int capacity)
 {
     if (capacity >= 0)
     {
         elementCount = 0;
         elementData  = newEntryArray <K, V>(capacity == 0 ? 1 : 0);
         loadFactor   = 7500; // Default load factor of 0.75
         computeMaxSize();
         referenceQueue = new java.lang.refj.ReferenceQueue <K>();
     }
     else
     {
         throw new java.lang.IllegalArgumentException();
     }
 }
コード例 #4
0
 /**
  * Initialise this subclass during construction, cloning or deserialization.
  */
 protected override void init()
 {
     queue = new java.lang.refj.ReferenceQueue <Object>();
 }
コード例 #5
0
 public WeakRef(int hash, Object r, java.lang.refj.ReferenceQueue <Object> q)
     : base(r, q)
 {
     this.hash = hash;
 }