码迷,mamicode.com
首页 > 其他好文 > 详细

软引用

时间:2015-07-14 15:25:29      阅读:203      评论:0      收藏:0      [点我收藏+]

标签:

 

1.Weak references are useful for mappings that 

should have their entries removed automatically 
once they are not referenced any more
弱引用 对映射数据有用,并且不再引用时被自动删掉
源码:

public class WeakReference<T> extends Reference<T> {

/**
* Constructs a new weak reference to the given referent. The newly created
* reference is not registered with any reference queue.
*
* @param r the referent to track
*/
public WeakReference(T r) {
super(r, null);
}

/**
* Constructs a new weak reference to the given referent. The newly created
* reference is registered with the given reference queue.
*
* @param r the referent to track
* @param q the queue to register to the reference object with. A null value
* results in a weak reference that is not associated with any
* queue.
*/
public WeakReference(T r, ReferenceQueue<? super T> q) {
super(r, q);
}
}

软引用

标签:

原文地址:http://www.cnblogs.com/qianrushi5/p/4645307.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!