首页 > 其他 > 详细

软引用

时间:2015-07-14 15:22:34      阅读:124      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!