weakreference
-
The implementation of WeakHashMap illustrates a common idiom with weak references & that some internal object extends WeakReference .
WeakHashMap的实现展示了弱引用的一种常见用法&一些内部对象扩展WeakReference。
-
The referent of a WeakReference is set at construction time , and its value , if it has not yet been cleared , can be retrieved with get () .
WeakReference的referent是在构造时设置的,在没有被清除之前,可以用get()获取它的值。
-
If the weak reference has been cleared ( either because the referent has already been garbage collected or because someone called WeakReference . clear ()), get () returns null .
如果弱引用被清除了(不管是referent已经被垃圾收集了,还是有人调用了WeakReference.clear()),get()会返回null。
-
The Entry type , which is used to store the key-value mapping , extends WeakReference , so when expungeStaleEntries () asks for the next expired weak reference , it gets back an Entry .
用于存储键-值映射的Entry类型扩展了WeakReference,因此当expungeStaleEntries()要求下一个失效的弱引用时,它得到一个Entry。